提交记录 40232


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 router32. 测测你的路由器 Wrong Answer 0 19.874 ms 209772 KB C++ 1.12 KB
提交时间 评测时间
2026-08-17 22:03:48 2026-08-17 22:03:51
/*zero mode=0*/
// 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 0
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 #112.735 ms152 MB + 292 KBWrong AnswerScore: 0

Testcase #218.582 ms204 MB + 876 KBWrong AnswerScore: 0

Testcase #38.753 ms53 MB + 920 KBWrong AnswerScore: 0

Testcase #419.874 ms154 MB + 320 KBWrong AnswerScore: 0


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