QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#121271 | #67. Two Transportations | zhylj | 0 ✓ | 0ms | 0kb | C++20 | 4.0kb | 2023-07-07 20:20:39 | 2023-09-11 02:06:39 |
Judging History
你现在查看的是测评时间为 2023-09-11 02:06:39 的历史记录
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-07-07 20:20:39]
- 提交
Azer
#include "Azer.h"
#include <bits/stdc++.h>
namespace {
#define fi first
#define se second
#define mkp std::make_pair
typedef std::pair <int, int> pii;
const int N_MAX = 2000 + 5, INF = 0x3fffffff, CINF = 511;
int N, d[N_MAX], lst_mn, cur_mn_idx, cur_mn, cnt, cnt_mx, res;
bool flag[N_MAX];
std::vector <int> q;
std::vector <pii> E[N_MAX];
void Add(int u, int v, int w) {
E[u].push_back(mkp(v, w));
E[v].push_back(mkp(u, w));
}
}
void InitA(int N, int A, std::vector <int> U, std::vector <int> V,
std::vector <int> C) {
memset(flag, false, sizeof(flag));
::N = res = N;
for(int i = 0; i < A; ++i)
Add(U[i], V[i], C[i]);
for(int i = 0; i < N; ++i)
d[i] = INF;
d[0] = lst_mn = 0; flag[0] = true;
for(auto p : E[0]) {
int v = p.fi, w = p.se;
d[v] = std::min(d[v], d[0] + w);
}
cur_mn = CINF;
for(int i = 0; i < N; ++i)
if(!flag[i] && cur_mn > d[i] - lst_mn) {
cur_mn = d[i] - lst_mn;
cur_mn_idx = i;
}
for(int i = 0; i < 9; ++i)
SendA((cur_mn >> i) & 1);
cnt_mx = 9; q.clear();
--res;
}
void ReceiveA(bool x) {
++cnt; q.push_back((int)x);
if(cnt < cnt_mx || !res) return;
int val = 0;
for(int i = 0; i < cnt_mx; ++i)
if(q[i]) val |= 1 << i;
q.clear(); cnt = 0;
if(cnt_mx == 9) {
if(cur_mn < val) {
int u = cur_mn_idx;
for(int i = 0; i < 11; ++i)
SendA((u >> i) & 1);
if(res) cnt_mx = 9;
else cnt_mx = 0;
} else {
cur_mn = val;
cnt_mx = 11;
return;
}
} else if(cnt_mx == 11) {
cur_mn_idx = val;
if(res) cnt_mx = 9;
else cnt_mx = 0;
}
lst_mn += cur_mn;
int u = cur_mn_idx;
flag[u] = true;
d[u] = lst_mn;
for(auto p : E[u]) {
int v = p.fi, w = p.se;
d[v] = std::min(d[v], d[u] + w);
}
cur_mn = CINF;
for(int i = 0; i < N; ++i)
if(!flag[i] && cur_mn > d[i] - lst_mn) {
cur_mn = d[i] - lst_mn;
cur_mn_idx = i;
}
for(int i = 0; i < 9; ++i)
SendA((cur_mn >> i) & 1);
--res;
}
std::vector<int> Answer() {
std::vector<int> ans(N);
for(int k = 0; k < N; ++k)
ans[k] = d[k];
return ans;
}
Baijan
#include "Baijan.h"
#include <bits/stdc++.h>
namespace {
#define fi first
#define se second
#define mkp std::make_pair
typedef std::pair <int, int> pii;
const int N_MAX = 2000 + 5, INF = 0x3fffffff, CINF = 511;
int N, d[N_MAX], lst_mn, cur_mn_idx, cur_mn, cnt, cnt_mx, res;
bool flag[N_MAX];
std::vector <int> q;
std::vector <pii> E[N_MAX];
void Add(int u, int v, int w) {
E[u].push_back(mkp(v, w));
E[v].push_back(mkp(u, w));
}
}
void InitB(int N, int A, std::vector <int> U, std::vector <int> V,
std::vector <int> C) {
memset(flag, false, sizeof(flag));
::N = res = N;
for(int i = 0; i < A; ++i)
Add(U[i], V[i], C[i]);
for(int i = 0; i < N; ++i)
d[i] = INF;
d[0] = lst_mn = 0; flag[0] = true;
for(auto p : E[0]) {
int v = p.fi, w = p.se;
d[v] = std::min(d[v], d[0] + w);
}
cur_mn = CINF;
for(int i = 0; i < N; ++i)
if(!flag[i] && cur_mn > d[i] - lst_mn) {
cur_mn = d[i] - lst_mn;
cur_mn_idx = i;
}
for(int i = 0; i < 9; ++i)
SendB((cur_mn >> i) & 1);
cnt_mx = 9; q.clear();
--res;
}
void ReceiveB(bool x) {
++cnt; q.push_back((int)x);
if(cnt < cnt_mx || !res) return;
int val = 0;
for(int i = 0; i < cnt_mx; ++i)
if(q[i]) val |= 1 << i;
q.clear(); cnt = 0;
if(cnt_mx == 9) {
if(cur_mn <= val) {
int u = cur_mn_idx;
for(int i = 0; i < 11; ++i)
SendB((u >> i) & 1);
if(res) cnt_mx = 9;
else cnt_mx = 0;
} else {
cur_mn = val;
cnt_mx = 11;
return;
}
} else if(cnt_mx == 11) {
cur_mn_idx = val;
if(res) cnt_mx = 9;
else cnt_mx = 0;
}
lst_mn += cur_mn;
int u = cur_mn_idx;
flag[u] = true;
d[u] = lst_mn;
for(auto p : E[u]) {
int v = p.fi, w = p.se;
d[v] = std::min(d[v], d[u] + w);
}
cur_mn = CINF;
for(int i = 0; i < N; ++i)
if(!flag[i] && cur_mn > d[i] - lst_mn) {
cur_mn = d[i] - lst_mn;
cur_mn_idx = i;
}
for(int i = 0; i < 9; ++i)
SendB((cur_mn >> i) & 1);
--res;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Interactor Dangerous Syscalls
Test #1:
score: 0
Interactor Dangerous Syscalls
input:
output:
input:
output:
result:
Subtask #2:
score: 0
Interactor Dangerous Syscalls
Test #7:
score: 0
Interactor Dangerous Syscalls
input:
output:
input:
output:
result:
Subtask #3:
score: 0
Interactor Dangerous Syscalls
Test #14:
score: 0
Interactor Dangerous Syscalls
input:
output:
input:
output:
result:
Subtask #4:
score: 0
Interactor Dangerous Syscalls
Test #24:
score: 0
Interactor Dangerous Syscalls
input:
output:
input:
output:
result:
Subtask #5:
score: 0
Interactor Dangerous Syscalls
Test #38:
score: 0
Interactor Dangerous Syscalls
input:
output:
input:
output:
result:
Subtask #6:
score: 0
Interactor Dangerous Syscalls
Test #51:
score: 0
Interactor Dangerous Syscalls
input:
output:
input:
output:
result:
Subtask #7:
score: 0
Interactor Dangerous Syscalls
Test #64:
score: 0
Interactor Dangerous Syscalls