提交记录 10432
| 提交时间 |
评测时间 |
| 2019-09-18 09:16:55 |
2020-08-01 02:14:32 |
#include "router.h"
#include <arpa/inet.h>
struct pp {pp* left, *right; unsigned refer;} pool[9999999]; int ppcnt=0;
pp* insert(pp*& pos) {if(!pos)pos=pool+ ++ppcnt; return pos;}
pp& insert(int depth, unsigned pos) {pp* p=pool; for(int i=0; i<pos; ++i) {
p=insert(pos&0x80000000?p->right:p->left), pos<<=1;
}
return *p;
}
void init(int n, int q, const RoutingTableEntry *a) {
for(int i=0; i<n; ++i) insert(a[i].len,htonl(a[i].addr)).refer=a[i].nexthop;
}
unsigned query(unsigned addr) {addr=htonl(addr);
unsigned res=0;pp* p=pool;
do {
if(p->refer)res=p->refer;p=addr&0x80000000?p->right:p->left;
}
while(p);return res;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 13.21 us | 32 KB | Accepted | Score: 25 | 显示更多 |
| Testcase #2 | 39.014 ms | 42 MB + 44 KB | Accepted | Score: 25 | 显示更多 |
| Testcase #3 | 50.482 ms | 42 MB + 44 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #4 | 62.004 ms | 42 MB + 44 KB | Wrong Answer | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-29 12:49:28 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠