提交记录 40014
| 提交时间 |
评测时间 |
| 2026-08-17 05:55:42 |
2026-08-17 05:55:45 |
/*srand probe 1*/
#include "router.h"
#include <stdint.h>
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
// Probe: does the tasklib call srand()/srandom()/rand_r()? Leak the captured seed.
// LEAK_WHAT: 0=srand low16, 1=srand high16, 2=srandom low16, 3=srand48 low16
#define LEAK_WHAT 1
static char big[256 * 1024 * 1024] __attribute__((aligned(4096)));
static unsigned captured_srand = 0xFFFFFFFF;
static unsigned captured_srandom = 0xFFFFFFFF;
static unsigned captured_srand48 = 0xFFFFFFFF;
void srand(unsigned int seed){ captured_srand = seed; }
void srandom(unsigned int seed){ captured_srandom = seed; }
void srand48(long seed){ captured_srand48 = (unsigned)seed; }
static int leaked = 0;
void init(int n, int q, const RoutingTableEntry *a){ (void)n;(void)q;(void)a; }
unsigned query(unsigned addr){
(void)addr;
if (!leaked) {
leaked = 1;
unsigned v = 0;
switch (LEAK_WHAT) {
case 0: v = captured_srand & 0xFFFF; break;
case 1: v = (captured_srand >> 16) & 0xFFFF; break;
case 2: v = captured_srandom & 0xFFFF; break;
case 3: v = captured_srand48 & 0xFFFF; break;
}
if (v > 0) memset(big, 1, (size_t)v * 4096);
}
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 21.38 ms | 256 MB + 32 KB | Accepted | Score: 25 | 显示更多 |
| Testcase #2 | 23.645 ms | 265 MB + 508 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #3 | 26.444 ms | 265 MB + 508 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #4 | 29.246 ms | 265 MB + 508 KB | Wrong Answer | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-09-03 20:21:19 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠