QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#716063 | #67. Two Transportations | Estelle_N | 0 | 9ms | 4028kb | C++20 | 2.8kb | 2024-11-06 14:13:09 | 2024-11-06 14:13:10 |
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;
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;
solve(w);
w = 0;
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3952kb
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:
wrong answer 2nd lines differ - expected: '2417', found: '1000000000'
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: 0ms
memory: 3908kb
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 1 0 0 1 0 0 1 0 1 1 0 0 1 0 0 -1 1 0 1 1 0 0 1 0 0 1 0 1 1 0 0 1 0 0 1 0 1 1 0 0 1 0 0 1 0 1 1 0 0 1 0 0 1 0 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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0 0 0 0 ...
input:
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''
Subtask #6:
score: 0
Wrong Answer
Test #51:
score: 0
Wrong Answer
time: 9ms
memory: 3888kb
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:
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:
wrong answer 2nd lines differ - expected: '4745', found: '1000000000'
Subtask #7:
score: 0
Wrong Answer
Test #64:
score: 0
Wrong Answer
time: 0ms
memory: 4028kb
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 1 1 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 -1 0 1 1 0 0 1 0 0 0 0 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 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 0 1 1 0 1 1 0 0 1 0 -1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 0 0 1 0 1 1 0 1 1 0 0 1 0 1 1 0 1 1 0 0 1 0 1 1 0...
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:
wrong answer 2nd lines differ - expected: '25855', found: '1000000000'