提交记录 10726
| 提交时间 |
评测时间 |
| 2019-09-28 16:40:41 |
2020-08-01 02:22:01 |
//#define Debug
#ifndef Debug
#include "router.h"
#endif
#ifdef Debug
typedef struct {
unsigned addr;
unsigned char len;
char pad[3]; // Padding for memory alignment
unsigned nexthop;
} __attribute__((packed)) RoutingTableEntry;
#endif
#include <cstdlib>
unsigned int ans=-1;
int maxlen=-1;
int n;
int q;
const RoutingTableEntry *a;
void init(int _n, int _q, const RoutingTableEntry *_a) {
n=_n;
q=_q;
a=_a;
}
inline unsigned reverse(unsigned x){
return ((x&0b11111111000000000000000000000000)>>24)
+((x&0b00000000111111110000000000000000)>>8)
+((x&0b00000000000000001111111100000000)<<8)
+((x&0b00000000000000000000000011111111)<<24);
}
unsigned query(unsigned addr) {
for (int i=0;i<n;i++){
if (((reverse(addr)>>(32-int(a[i].len)))==(reverse(a[i].addr)>>(32-int(a[i].len))))&&(int(a[i].len)>maxlen)){
maxlen=a[i].len;
ans=a[i].nexthop;
}
}
return ans;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 13.64 us | 24 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #2 | 3.826 ms | 9 MB + 500 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #3 | 30 s | 9 MB + 496 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #4 | 30 s | 9 MB + 496 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-29 01:51:23 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠