QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#273427 | #67. Two Transportations | DaiRuiChen007 | 0 | 1ms | 3936kb | C++20 | 2.1kb | 2023-12-02 23:49:57 | 2023-12-02 23:49:58 |
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;
for(auto e:G[u]) dis[e.v]=min(dis[e.v],dis[u]+e.w);
int p=-1;
for(int i=0;i<n;++i) if(!vis[i]&&(p==-1||dis[i]<dis[p])) p=i;
if(p==-1) return ;
dA=dis[p]-lstdis,lstdis+=dis[p],typ=0,rdcnt=9,vA=p;
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]=lstdis=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;
for(auto e:G[u]) dis[e.v]=min(dis[e.v],dis[u]+e.w);
int p=-1;
for(int i=0;i<n;++i) if(!vis[i]&&(p==-1||dis[i]<dis[p])) p=i;
if(p==-1) return ;
dB=dis[p]-lstdis,lstdis+=dis[p],typ=0,rdcnt=9,vB=p;
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]=lstdis=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: 1ms
memory: 3936kb
input:
0 0 0 0 0 0 0 0 0 -1 -1 -1
output:
-1 0 1 0 1 1 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 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: 1ms
memory: 3764kb
input:
-1
output:
-1 -1
input:
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 3772kb
input:
0 0 0 0 0 0 0 0 0 -1 -1 -1
output:
-1 0 1 1 0 1 0 1 0 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 0 0 1 1 1 0 0 1 -1 0 0 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 1 0 -1 0 1 1 0 0 1 0 0 1 1 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 1 1 0 1 1 0 1 0 0 1 1 1 0 1 1 1 0 1 1 1 0 1 0 0 1 0 -1
output:
-1 1 1 0 1 0 0 1 0 1 -1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 0 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: 3752kb
input:
0 0 0 0 0 0 0 0 0 -1 -1 -1
output:
-1 0 1 0 0 1 0 0 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: 3756kb
input:
0 0 1 0 1 1 1 1 0 -1 -1 -1
output:
-1 0 0 0 0 0 0 0 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 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: 0ms
memory: 3784kb
input:
0 0 0 0 0 0 0 0 0 -1 -1 -1
output:
-1 0 1 0 1 1 0 0 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 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 0 0 0 0 -1 1 0 0 0 1 1 1 0 1 0 0 1 0 0 0 0 1 1 1 0 -1 1 0 0 0 0 1 1 0 0 1 1 0 1 1 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 1 0 1 0 0 1 0 1 1 -1
output:
-1 1 1 1 1 1 0 0 1 1 -1 1 1 1 1 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 0 -1
input:
output:
result:
wrong answer 1st lines differ - expected: '0', found: ''