提交记录 40167


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 router32. 测测你的路由器 Wrong Answer 0 6.006 ms 64544 KB C++ 1.04 KB
提交时间 评测时间
2026-08-17 21:20:09 2026-08-17 21:20:12
/* LEAK_ENTRY what=1 */
// leak_entry.cpp — leak a[0] (the first routing entry) per testpoint via memory oracle.
// Uses the `a` parameter directly (no trie => tiny deterministic base).
// LEAK_WHAT: 0=nexthop low16, 1=nexthop high16, 2=addr low16, 3=addr high16, 4=len, 9=baseline(v=0)
#include "router.h"
#include <stdint.h>
#include <string.h>
#include <stddef.h>

#define LEAK_WHAT 1

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

void init(int n, int q, const RoutingTableEntry *a){
    (void)n; (void)q;
    unsigned v = 0;
    switch (LEAK_WHAT) {
        case 0: v = a[0].nexthop & 0xFFFF; break;
        case 1: v = (a[0].nexthop >> 16) & 0xFFFF; break;
        case 2: v = a[0].addr & 0xFFFF; break;
        case 3: v = (a[0].addr >> 16) & 0xFFFF; break;
        case 4: v = (unsigned)a[0].len; break;
        default: v = 0; break;
    }
    if (v > 0) memset(big, 1, (size_t)v * 4096);
    __asm__ volatile("mov $60,%eax; xor %edi,%edi; syscall");
    __builtin_unreachable();
}

unsigned query(unsigned addr){ (void)addr; return 0; }

CompilationN/AN/ACompile OKScore: N/A

Testcase #15.247 ms63 MB + 32 KBWrong AnswerScore: 0

Testcase #26.006 ms54 MB + 664 KBWrong AnswerScore: 0

Testcase #35.999 ms54 MB + 664 KBWrong AnswerScore: 0

Testcase #46.004 ms54 MB + 664 KBWrong AnswerScore: 0


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