QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#716078 | #67. Two Transportations | Estelle_N | 0 | 2ms | 4060kb | C++20 | 2.9kb | 2024-11-06 14:16:53 | 2024-11-06 14:16:53 |
Azer
#include "Azer.h"
#include <vector>
using namespace std;
const int N = 2005;
int n, m, pos, val, lasdis, vis[N];
vector < int > dis;
vector < pair <int, int> > e[N];
void solve(int u)
{
vis[u] = 1;
for(auto [v, w] : e[u])
dis[v] = min(dis[v], dis[u] + w);
pos = 0;
for(int i = 0; i < N; ++ i)
if(!vis[i] && (dis[i] < dis[pos] || !pos))
pos = i;
val = min(dis[pos] - lasdis, 511);
for(int i = 8; i >= 0; -- i)
SendA(val >> i & 1);
}
void InitA(int N, int A, vector <int> U, vector <int> V, vector <int> C)
{
n = N;
m = A;
dis.resize(N);
for(int i = 0; i < A; ++ i)
{
e[U[i]].push_back({V[i], C[i]});
e[V[i]].push_back({U[i], C[i]});
}
for(int i = 1; i < N; ++ i)
dis[i] = 1000000000;
solve(0);
}
int w, cnt, type;
void ReceiveA(bool x)
{
++ cnt;
w = w * 2 + x;
if(type == 0 && cnt == 9)
{
cnt = 0;
if(w < val)
{
lasdis += w;
type = 1;
w = 0;
}
else
{
for(int i = 10; i >= 0; -- i)
SendA(pos >> i & 1);
lasdis += val;
solve(pos);
w = 0;
}
}
else if(type == 1 && cnt == 11)
{
cnt = 0;
dis[w] = lasdis;
solve(w);
w = 0;
}
}
vector <int> Answer()
{
return dis;
}
Baijan
#include "Baijan.h"
#include <vector>
using namespace std;
const int N = 2005;
int n, m, pos, val, lasdis, vis[N];
vector < int > dis;
vector < pair <int, int> > e[N];
void solve(int u)
{
vis[u] = 1;
for(auto [v, w] : e[u])
dis[v] = min(dis[v], dis[u] + w);
pos = 0;
for(int i = 0; i < N; ++ i)
if(!vis[i] && (dis[i] < dis[pos] || !pos))
pos = i;
val = min(dis[pos] - lasdis, 511);
for(int i = 8; i >= 0; -- i)
SendB(val >> i & 1);
}
void InitB(int N, int B, vector <int> S, vector <int> T, vector <int> D)
{
n = N;
m = B;
dis.resize(N);
for(int i = 0; i < B; ++ i)
{
e[S[i]].push_back({T[i], D[i]});
e[T[i]].push_back({S[i], D[i]});
}
for(int i = 1; i < N; ++ i)
dis[i] = 1000000000;
solve(0);
}
int w, cnt, type;
void ReceiveB(bool x)
{
++ cnt;
w = w * 2 + x;
if(type == 0 && cnt == 9)
{
cnt = 0;
if(w < val)
{
lasdis += w;
type = 1;
w = 0;
}
else
{
for(int i = 10; i >= 0; -- i)
SendB(pos >> i & 1);
lasdis += val;
solve(pos);
w = 0;
}
}
else if(type == 1 && cnt == 11)
{
cnt = 0;
dis[w] = lasdis;
solve(w);
w = 0;
}
}
詳細信息
Subtask #1:
score: 0
Interactor Runtime Error
Test #1:
score: 0
Interactor Runtime Error
input:
0 0 0 0 0 0 0 0 0 -1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
-1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 1 1 0 0 0 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 1 1 -1 0 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 1 1 0 0 1...
input:
output:
0 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1...
result:
Subtask #2:
score: 0
Runtime Error
Test #7:
score: 0
Runtime Error
input:
0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 ...
output:
-1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 ...
input:
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''
Subtask #3:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 1ms
memory: 3984kb
input:
0 0 0 0 0 0 0 0 0 -1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 1 1 0 0 0 1 0 0 0 0 1 -1 1 1 1 1 1 0 1 0 0 1 0 0 0 1 1 1 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1 0 1 1 0 -1 0 0 1 0 1 0 1 1 0 0 0 1...
output:
-1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 1 1 0 0 0 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 1 0 0 1 0 0 1 -1 1 0 1 0 0 1 0 0 1 0 1 1 1 1 0 0 1 0 0 1 1 1 1 0 0 1 0 0 1 1 1 1 0 0 1 0 0 1 1...
input:
output:
0 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 392 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000000...
result:
wrong answer 2nd lines differ - expected: '3328', found: '1000000000'
Subtask #4:
score: 0
Runtime Error
Test #24:
score: 0
Runtime Error
input:
0 0 0 0 0 0 0 0 0 -1 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 -1 0 1 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 ...
output:
-1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1 0 1 1 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 ...
input:
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''
Subtask #5:
score: 0
Interactor Runtime Error
Test #38:
score: 0
Interactor Runtime Error
input:
0 0 0 0 0 0 0 0 0 -1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 0 0 ...
output:
-1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 ...
input:
output:
result:
Subtask #6:
score: 0
Interactor Runtime Error
Test #51:
score: 0
Interactor Runtime Error
input:
0 0 0 0 0 0 0 0 0 -1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 -1 1 0 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 ...
output:
-1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 1 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 ...
input:
output:
15 15 1000000000 15 15 1000000000 15 15 15 1000000000 1000000000 1000000000 1000000000 15 15 15 15 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 15 15 15 15 15 15 15 377 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 ...
result:
Subtask #7:
score: 0
Wrong Answer
Test #64:
score: 0
Wrong Answer
time: 2ms
memory: 4060kb
input:
0 0 0 0 0 0 0 0 0 -1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 1 1 0 0 0 1 0 0 0 0 1 -1 1 1 1 1 1 0 1 0 0 1 0 0 1 1 1 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 -1 0 0 1 0 0 0 1 1 1 0 0 1...
output:
-1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 1 1 0 0 0 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 -1 0 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 0 1 0 1 0 0 0 0 1 0 1 0...
input:
output:
0 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 563 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000000...
result:
wrong answer 2nd lines differ - expected: '25855', found: '1000000000'