QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#274190 | #67. Two Transportations | DaiRuiChen007 | 0 | 1ms | 3864kb | C++20 | 2.0kb | 2023-12-03 12:44:28 | 2023-12-03 12:44:28 |
Azer
#include<bits/stdc++.h>
#include "Azer.h"
using namespace std;
const int MAXN=2005,inf=1e9;
int n,m,ver,dA,dB,lstdis,vA,vB,typ,rdcnt;
//typ=0:read dis,typ=1:read ver
vector <int> dis,vis;
struct Edge { int v,w; };
vector <vector<Edge>> G;
void upd(int u) {
vis[u]=true,lstdis=dis[u];
for(auto e:G[u]) dis[e.v]=min(dis[e.v],dis[u]+e.w);
vA=-1,dA=lstdis+511;
for(int i=0;i<n;++i) if(!vis[i]&&dA>dis[i]) vA=i;
if(vA==-1) return ;
dA-=lstdis,typ=0,rdcnt=9;
for(int k=8;~k;--k) SendA((dA>>k)&1);
}
void InitA(int N,int A,vector<int> U,vector<int> V,vector<int> C) {
n=N,m=A,dis.resize(n,inf),vis.resize(n),G.resize(n);
for(int i=0;i<m;++i) {
G[U[i]].push_back({V[i],C[i]});
G[V[i]].push_back({U[i],C[i]});
}
dis[0]=0,upd(0);
}
void ReceiveA(bool x) {
if(typ) vB=vB*2+x;
else dB=dB*2+x;
if(!--rdcnt) {
if(typ) dis[vB]=lstdis+dB,upd(vB);
else {
if(dA<=dB) {
for(int k=10;~k;--k) SendA((vA>>k)&1);
dis[vA]=lstdis+dA,upd(vA);
} else typ=1,rdcnt=11;
}
}
}
vector<int> Answer() { return dis; }
Baijan
#include<bits/stdc++.h>
#include "Baijan.h"
using namespace std;
const int MAXN=2005,inf=1e9;
int n,m,ver,dA,dB,lstdis,vA,vB,typ,rdcnt;
//typ=0:read dis,typ=1:read ver
vector <int> dis,vis;
struct Edge { int v,w; };
vector <vector<Edge>> G;
void upd(int u) {
vis[u]=true,lstdis=dis[u];
for(auto e:G[u]) dis[e.v]=min(dis[e.v],dis[u]+e.w);
vB=-1,dB=lstdis+511;
for(int i=0;i<n;++i) if(!vis[i]&&dB>dis[i]) vB=i;
if(vB==-1) return ;
dB-=lstdis,typ=0,rdcnt=9;
for(int k=8;~k;--k) SendB((dB>>k)&1);
}
void InitB(int N,int B,vector<int> U,vector<int> V,vector<int> C) {
n=N,m=B,dis.resize(n,inf),vis.resize(n),G.resize(n);
for(int i=0;i<m;++i) {
G[U[i]].push_back({V[i],C[i]});
G[V[i]].push_back({U[i],C[i]});
}
dis[0]=0,upd(0);
}
void ReceiveB(bool x) {
if(typ) vA=vA*2+x;
else dA=dA*2+x;
if(!--rdcnt) {
if(typ) dis[vA]=lstdis+dA,upd(vA);
else {
if(dB<dA) {
for(int k=10;~k;--k) SendB((vB>>k)&1);
dis[vB]=lstdis+dB,upd(vB);
} else typ=1,rdcnt=11;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3864kb
input:
-1
output:
-1 1 1 1 1 1 1 1 1 1 -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
Wrong Answer
Test #7:
score: 8
Accepted
time: 0ms
memory: 3624kb
input:
-1
output:
-1 -1
input:
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Wrong Answer
time: 1ms
memory: 3824kb
input:
-1
output:
-1 1 1 1 1 1 1 1 1 1 -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: '128264', found: '1000000000'
Subtask #3:
score: 0
Runtime Error
Test #14:
score: 0
Runtime Error
input:
1 1 1 1 1 1 1 1 1 -1 0 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 -1 0 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 -1
output:
-1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 -1
input:
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''
Subtask #4:
score: 0
Wrong Answer
Test #24:
score: 0
Wrong Answer
time: 1ms
memory: 3852kb
input:
-1
output:
-1 1 1 1 1 1 1 1 1 1 -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: '1881', found: '1000000000'
Subtask #5:
score: 0
Wrong Answer
Test #38:
score: 0
Wrong Answer
time: 1ms
memory: 3688kb
input:
1 1 1 1 1 1 1 1 1 -1 -1
output:
-1 -1 -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: '3467', found: '1000000000'
Subtask #6:
score: 0
Wrong Answer
Test #51:
score: 0
Wrong Answer
time: 1ms
memory: 3704kb
input:
-1
output:
-1 1 1 1 1 1 1 1 1 1 -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: '4745', found: '1000000000'
Subtask #7:
score: 0
Runtime Error
Test #64:
score: 0
Runtime Error
input:
1 1 1 1 1 1 1 1 1 -1 1 0 0 0 1 1 1 0 1 0 0 1 1 1 1 1 1 1 1 1 -1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 -1
output:
-1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 -1
input:
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''