提交记录 40233


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 router32. 测测你的路由器 Wrong Answer 0 20.901 ms 188264 KB C++ 1.12 KB
提交时间 评测时间
2026-08-17 22:03:53 2026-08-17 22:03:56
/*zero mode=1*/
// leak_printf_zero.cpp — leak the tasklib's printf arg x when query() returns 0 (WRONG).
// Determines whether the printed checksum x depends on our query() returns.
// MODE: 0=x low16, 1=x high16, 9=baseline(v=0)
#include "router.h"
#include <stdint.h>
#include <stddef.h>
#include <stdarg.h>
#include <string.h>

#define MODE 1
static volatile int g_mode = MODE;

static char big[256 * 1024 * 1024] __attribute__((aligned(4096)));

void init(int n, int q, const RoutingTableEntry *a){ (void)n; (void)q; (void)a; }
unsigned query(unsigned addr){ (void)addr; return 0; }

extern "C" int printf(const char *fmt, ...){
    static int calls = 0;
    calls++;
    if (calls == 1) {
        unsigned v = 0;
        if (g_mode == 0) {
            va_list ap; va_start(ap, fmt); unsigned x = va_arg(ap, unsigned); va_end(ap);
            v = x & 0xFFFF;
        } else if (g_mode == 1) {
            va_list ap; va_start(ap, fmt); unsigned x = va_arg(ap, unsigned); va_end(ap);
            v = (x >> 16) & 0xFFFF;
        } else {
            v = 0;
        }
        if (v > 0) memset(big, 1, (size_t)v * 4096);
    }
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #115.37 ms183 MB + 872 KBWrong AnswerScore: 0

Testcase #24.943 ms42 MB + 476 KBWrong AnswerScore: 0

Testcase #317.125 ms155 MB + 368 KBWrong AnswerScore: 0

Testcase #420.901 ms166 MB + 736 KBWrong AnswerScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2026-09-03 16:06:25 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠