提交记录 10319
| 提交时间 |
评测时间 |
| 2019-09-17 16:20:56 |
2020-08-01 02:07:44 |
#include <unordered_map>
#include <arpa/inet.h>
#include "router.h"
std::unordered_map<unsigned, unsigned> M[256][33];
void ins(const RoutingTableEntry *e) {
M[e->addr&255][e->len][htonl(e->addr)] = e->nexthop;
}
void init(int n, int q, const RoutingTableEntry *tbl) {
for (int i = 0; i < n; i++) {
ins(tbl + i);
}
}
unsigned query(unsigned addr) {unsigned char bb=addr;
addr = htonl(addr);
for (int i = 32; i >= 0; i--) {
if (M[bb][i].count(addr) > 0) {
return M[bb][i][addr];
}
addr &= ~(1u << (32 - i));
}
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 96.7 us | 484 KB | Accepted | Score: 25 | 显示更多 |
| Testcase #2 | 67.501 ms | 44 MB + 628 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #3 | 778.645 ms | 44 MB + 628 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #4 | 1.489 s | 44 MB + 628 KB | Wrong Answer | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-29 18:28:09 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠