提交记录 10766


用户 题目 状态 得分 用时 内存 语言 代码长度
duck router32. 测测你的路由器 Wrong Answer 25 4.49 s 9716 KB C++ 430 B
提交时间 评测时间
2019-09-30 00:04:38 2020-08-01 02:28:24
#include "router.h"
int nn;
const RoutingTableEntry *b;
void init(int n, int q, const RoutingTableEntry *a) {
	b=a;nn=n;
}

unsigned query(unsigned addr) {
for (int k=32;k>=0;k--){
int lo=nn-1,hi=-1;
while (lo-hi>1){
int mid=(lo+hi)/2;
if (b[mid].addr>=addr) lo=mid;
else hi=mid;
}
for (int i=lo;i<nn;i++){
if (b[i].addr==addr){
if (b[i].len==k) return b[i].nexthop;
}else{
break;
}
}
addr&=~(1<<((k-1)/8+(k-1)%8));
}
	return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #111.73 us24 KBAcceptedScore: 25

Testcase #22.219 ms9 MB + 500 KBWrong AnswerScore: 0

Testcase #32.246 s9 MB + 500 KBWrong AnswerScore: 0

Testcase #44.49 s9 MB + 500 KBWrong AnswerScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2026-03-29 00:19:52 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠