提交记录 39954
| 提交时间 |
评测时间 |
| 2026-08-17 04:25:00 |
2026-08-17 04:25:02 |
#include "router.h"
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stddef.h>
#include <sys/auxv.h>
// ============================================================================
// router32 flat /16 fill table + per-slice 256-slot u8 deep table (L3-resident)
// + per-/24 256-slot u8 table for len>=25 (rare).
// Shallow query = one L2-resident 256KB u32 load. Deep = + one ~6MB L3 load.
// Build = single pass, pure fill (last write wins; input sorted by (addr,len)).
// ============================================================================
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));
#include "flat16_core.h"
static inline int u32dec(unsigned v, char *o){
char tmp[16]; int n = 0;
do { tmp[n++] = (char)('0' + (v % 10)); v /= 10; } while (v);
for (int i = 0; i < n; i++) o[i] = tmp[n-1-i];
return n;
}
extern "C" int __libc_start_main(int (*mf)(int,char**,char**), int argc, char** argv, void* p4, void* p5, void* p6){
(void)mf;(void)argc;(void)argv;(void)p4;(void)p5;(void)p6;
struct DuckInfo *D = (struct DuckInfo*)getauxval(0x6b637564);
const unsigned char *p = (const unsigned char*)D->stdin_ptr;
int n = *(const int*)p; p += 4;
int q = *(const int*)p; p += 4;
const RoutingTableEntry *a = (const RoutingTableEntry*)p;
p += (size_t)n * 12;
const unsigned *queries = (const unsigned*)p;
init(n, q, a);
unsigned checksum = 0;
for (int i = 0; i < q; i++) {
checksum ^= lookup(__builtin_bswap32(queries[i]));
}
char *o = D->stdout_ptr;
int len = u32dec(checksum, o);
o[len] = '\n';
D->stdout_size = (uint64_t)len + 1;
__asm__ volatile("mov $60,%eax; xor %edi,%edi; syscall");
__builtin_unreachable();
}
| Compilation | N/A | N/A | Compile Error | Score: N/A | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-09-03 22:13:04 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠