提交记录 36261


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 1001c. 测测你的排序4 Wrong Answer 0 6.86 us 12 KB C++ 647 B
提交时间 评测时间
2026-08-15 01:35:40 2026-08-15 01:35:45
// Test "arithmetic progression mod 2^32" (a[i+1]-a[i] == const), and if so
// reveal the top 16 bits of the step via memory side-channel.
// not-arith: 1 page -> mem ~12 KB.
// arith:     2 + (step>>16) pages -> mem ~ 8 + 4*(2 + step>>16) KB.
static volatile unsigned char pages[65540 * 4096];
void sort(unsigned *a, int n) {
    unsigned step = a[1] - a[0];
    int arith = 1;
    for (int i = 1; i + 1 < n; i++) {
        if ((a[i+1] - a[i]) != step) { arith = 0; break; }
    }
    int npages;
    if (arith) npages = 2 + (int)(step >> 16);
    else       npages = 1;
    for (int i = 0; i < npages; i++) pages[i * 4096] = (unsigned char)i;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #16.86 us12 KBWrong AnswerScore: 0


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