提交记录 10427
| 提交时间 |
评测时间 |
| 2019-09-17 21:52:42 |
2020-08-01 02:14:31 |
#include "router.h"
#include <stdint.h>
#include <assert.h>
/*
Maptable:
Stores [0,678) x [0,16) -> [0,16) : 10.6KB
Stores [0,2^16) -> [0,678) : 128KB
*/
const int MAPTABLE_MAX_SIZE = 678;
int maptable_size;
uint8_t maptable[MAPTABLE_MAX_SIZE][16];
uint16_t maptable_index_map[1 << 16];
/*
Init maptable
1. dfs all possible 16-bit tries
2. calculate prefix sums
*/
inline void maptable_add(int vec) {
maptable_index_map[vec] = maptable_size;
int cnt = 0;
for (int i = 0; i < 16; i++) {
cnt += (vec >> i) & 1;
maptable[maptable_size][i] = cnt;
}
++maptable_size;
}
inline bool maptable_element_check(int vec, int bits = 16) {
if (vec == 1) return 1;
bits >>= 1;
int mask = (1 << bits) - 1;
return maptable_element_check(vec & mask, bits)
&& maptable_element_check(vec >> bits, bits);
}
void init_maptable() {
maptable_size = 0;
for (int i = 1; i < 1 << 16; i++) {
if (maptable_element_check(i)) {
maptable_add(i);
}
}
}
void init(int n, int q, const RoutingTableEntry *a) {
init_maptable();
assert(maptable_size == 677);
}
unsigned query(unsigned addr) {
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 133.002 ms | 1087 MB + 888 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #2 | 131.225 ms | 1087 MB + 888 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #3 | 142.711 ms | 1087 MB + 888 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #4 | 130.665 ms | 1087 MB + 888 KB | Runtime Error | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-29 14:43:05 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠