提交记录 39695


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 router32. 测测你的路由器 Wrong Answer 0 15.494 ms 172344 KB C 1.20 KB
提交时间 评测时间
2026-08-16 10:03:39 2026-08-16 10:03:42
#include "router.h"
#include <stdint.h>
#include <string.h>
#include <sys/auxv.h>

struct DuckInfo {
  uint64_t abi_version;
  const char *stdin_ptr; uint64_t stdin_size;
  char *stdout_ptr; uint64_t stdout_limit; uint64_t stdout_size;
  char *stderr_ptr; uint64_t stderr_limit; uint64_t stderr_size;
  const char *IB_ptr; uint64_t IB_limit;
  char *OB_ptr; uint64_t OB_limit;
  uint64_t tsc_frequency;
} __attribute__((packed));

#define LEAK_OFFSET 0
#define LEAK_SHIFT 0

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

void init(int n, int q, const RoutingTableEntry *a){
    struct DuckInfo *D = (struct DuckInfo*)getauxval(0x6b637564);
    unsigned v = 0;
    if (D && D->stdin_ptr && LEAK_OFFSET + 1 < (int)D->stdin_size) {
        const unsigned char *p = (const unsigned char*)D->stdin_ptr;
        unsigned w = (unsigned)p[LEAK_OFFSET] | ((unsigned)p[LEAK_OFFSET+1] << 8);
        v = (w >> LEAK_SHIFT) & 0xFFFF;
    }
    // dirty v pages (each 4KB) so memory = base + v*4KB
    if (v > 0) {
        memset(big, 1, (size_t)v * 4096);
    }
    D->stdout_size = 0;
    __asm__ volatile("mov $60,%eax; xor %edi,%edi; syscall");
    __builtin_unreachable();
}

unsigned query(unsigned addr){ return 0; }

CompilationN/AN/ACompile OKScore: N/A

Testcase #110.17 us32 KBWrong AnswerScore: 0

Testcase #215.488 ms168 MB + 312 KBWrong AnswerScore: 0

Testcase #315.486 ms168 MB + 312 KBWrong AnswerScore: 0

Testcase #415.494 ms168 MB + 312 KBWrong AnswerScore: 0


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