提交记录 13291
| 提交时间 |
评测时间 |
| 2020-08-01 09:53:17 |
2020-08-01 09:53:23 |
#include<bits/stdc++.h>
#include"router.h"
using namespace std;
struct hasher{
size_t operator()(const pair<unsigned,unsigned>&p)const{
size_t tmp=hash<unsigned>()(p.first)+0x9e3779b9;
return tmp^(hash<unsigned>()(p.second)+0x9e3779b9+(tmp<<6)+(tmp>>2));
}
};
unordered_map<pair<unsigned,unsigned>,unsigned,hasher>hop;
void init(int n,int q,const RoutingTableEntry*a){
for(int i=0;i<n;++i){
for(int j=32-a[i].len;j<32;++j)hop[make_pair(a[i].addr&(1u<<j),32-j)]=a[i].nexthop;
}
}
unsigned query(unsigned addr){
unsigned len=31;
while(len){
if(hop.find(make_pair(addr,len))!=hop.end())return hop[make_pair(addr,len)];
addr>>=1;
--len;
}
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 40.85 us | 40 KB | Accepted | Score: 25 | 显示更多 |
| Testcase #2 | 292.081 ms | 9 MB + 516 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #3 | 967.558 ms | 9 MB + 516 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #4 | 1.651 s | 9 MB + 516 KB | Wrong Answer | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-24 15:06:10 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠