QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#122618 | #67. Two Transportations | jrjyy | Compile Error | / | / | C++20 | 4.1kb | 2023-07-10 20:37:46 | 2023-07-10 20:37:47 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-07-10 20:37:47]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-07-10 20:37:46]
- 提交
Azer
/* joisc2019_2c_azer.cpp */
#include "azer.h"
#include <bits/stdc++.h>
namespace {
void send(bool x) { SendA(x); }
constexpr int inf = 1e6, LgN = 11, LgW = 9;
bool first; int n, cnt; std::vector<int> dis, vs;
std::vector<std::vector<std::pair<int, int>>> adj;
void addEdge(int u, int v, int w) { adj[u].push_back({v, w}); }
std::priority_queue<std::pair<int, int>> h;
void init(bool f, int n_, int m, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
first = f, n = n_, adj.resize(n), dis.resize(n, inf), dis[0] = 0, h.push({0, 0}), vs.resize(n);
for (int i = 0; i < m; ++i) addEdge(U[i], V[i], W[i]), addEdge(V[i], U[i], W[i]);
}
std::deque<bool> msg;
int getMsg(int len) {
int x = 0;
while (len--) x = x << 1 | msg.front(), msg.pop_front();
return x;
}
void setMsg(int x, int len) {
x = std::min(x, (1 << len) - 1);
while (len--) send(x >> len & 1);
}
int lst, typ, nd;
void query() {
typ = 0;
while (!h.empty() && vs[h.top().second]) h.pop();
setMsg(h.empty() ? inf : -h.top().first - lst, LgW);
}
void relax(int u) {
vs[u] = 1, ++cnt;
for (auto p : adj[u]) {
int v = p.first, w = p.second;
if (dis[v] > dis[u] + w) dis[v] = dis[u] + w, h.push({-dis[v], v});
}
}
void receive(bool x) {
msg.push_back(x);
if (typ == 0) {
if (int(msg.size()) < LgW) return;
nd = getMsg(LgW) + lst;
if (!h.empty() && -h.top().first - first < nd) {
int u = h.top().second; lst = -h.top().first, h.pop();
relax(u), setMsg(u, LgN);
if (cnt < n) query();
} else {
lst = nd, typ = 1;
}
} else {
if (int(msg.size()) < LgN) return;
int u = getMsg(LgN);
dis[u] = nd, relax(u);
if (cnt < n) query();
}
}
std::vector<int> answer() { return dis; }
}
void InitA(int n, int m, std::vector <int> U, std::vector <int> V, std::vector <int> W) {
::init(true, n, m, U, V, W), ::query();
}
void ReceiveA(bool x) { ::receive(x); }
std::vector<int> Answer() { return ::answer(); }
Baijan
/* joisc2019_2c_baijan.cpp */
#include "baijan.h"
#include <bits/stdc++.h>
namespace {
void send(bool x) { SendB(x); }
constexpr int inf = 1e6, LgN = 11, LgW = 9;
bool first; int n, cnt; std::vector<int> dis, vs;
std::vector<std::vector<std::pair<int, int>>> adj;
void addEdge(int u, int v, int w) { adj[u].push_back({v, w}); }
std::priority_queue<std::pair<int, int>> h;
void init(bool f, int n_, int m, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
first = f, n = n_, adj.resize(n), dis.resize(n, inf), dis[0] = 0, h.push({0, 0}), vs.resize(n);
for (int i = 0; i < m; ++i) addEdge(U[i], V[i], W[i]), addEdge(V[i], U[i], W[i]);
}
std::deque<bool> msg;
int getMsg(int len) {
int x = 0;
while (len--) x = x << 1 | msg.front(), msg.pop_front();
return x;
}
void setMsg(int x, int len) {
x = std::min(x, (1 << len) - 1);
while (len--) send(x >> len & 1);
}
int lst, typ, nd;
void query() {
typ = 0;
while (!h.empty() && vs[h.top().second]) h.pop();
setMsg(h.empty() ? inf : -h.top().first - lst, LgW);
}
void relax(int u) {
vs[u] = 1, ++cnt;
for (auto p : adj[u]) {
int v = p.first, w = p.second;
if (dis[v] > dis[u] + w) dis[v] = dis[u] + w, h.push({-dis[v], v});
}
}
void receive(bool x) {
msg.push_back(x);
if (typ == 0) {
if (int(msg.size()) < LgW) return;
nd = getMsg(LgW) + lst;
if (!h.empty() && -h.top().first - first < nd) {
int u = h.top().second; lst = -h.top().first, h.pop();
relax(u), setMsg(u, LgN);
if (cnt < n) query();
} else {
lst = nd, typ = 1;
}
} else {
if (int(msg.size()) < LgN) return;
int u = getMsg(LgN);
dis[u] = nd, relax(u);
if (cnt < n) query();
}
}
}
void InitB(int n, int m, std::vector <int> U, std::vector <int> V, std::vector <int> W) {
::init(false, n, m, U, V, W), ::query();
}
void ReceiveB(bool x) { ::receive(x); }
詳細信息
Azer.code:2:10: fatal error: azer.h: No such file or directory 2 | #include "azer.h" | ^~~~~~~~ compilation terminated. grader_Azer.cpp: In function ‘int main(int, char**)’: grader_Azer.cpp:37:13: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 37 | char *t = "/dev/null"; | ^~~~~~~~~~~