提交记录 13302
提交时间 |
评测时间 |
2020-08-01 10:05:07 |
2020-08-01 10:05:13 |
#include<bits/stdc++.h>
#include<arpa/inet.h>
#include"router.h"
using namespace std;
unordered_map<unsigned,unsigned>hop[33];
void init(int n,int q,const RoutingTableEntry*a){
for(int i=0;i<n;++i){
hop[a[i].len][htonl(a[i].addr)]=a[i].nexthop;
}
}
unsigned query(unsigned addr){
addr=htonl(addr);
for(int i=32;~i;--i){
if(hop[i].find(addr)!=hop[i].end())return hop[i][addr];
addr&=~(1ll<<(32-i));
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 37.95 us | 36 KB | Accepted | Score: 25 | 显示更多 |
Testcase #2 | 151.274 ms | 42 MB + 320 KB | Accepted | Score: 25 | 显示更多 |
Testcase #3 | 1.278 s | 42 MB + 320 KB | Accepted | Score: 25 | 显示更多 |
Testcase #4 | 2.404 s | 42 MB + 320 KB | Accepted | Score: 25 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:17:19 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠