QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#274197 | #67. Two Transportations | DaiRuiChen007 | 0 | 3ms | 3948kb | C++20 | 2.1kb | 2023-12-03 12:47:12 | 2023-12-03 12:47:12 |
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,dB=0;
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,vB=0;
}
}
}
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,dA=0;
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,vA=0;
}
}
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3916kb
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: 3672kb
input:
-1
output:
-1 -1
input:
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Wrong Answer
time: 1ms
memory: 3892kb
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
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 0ms
memory: 3816kb
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 1 0 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 -1 0 0 0 0 0 0 1 0 0 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 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
input:
output:
0 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 2044 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000...
result:
wrong answer 2nd lines differ - expected: '3328', found: '1000000000'
Subtask #4:
score: 0
Wrong Answer
Test #24:
score: 0
Wrong Answer
time: 0ms
memory: 3744kb
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: 3804kb
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: 0ms
memory: 3784kb
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
Wrong Answer
Test #64:
score: 0
Wrong Answer
time: 3ms
memory: 3948kb
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 -1 0 1 0 0 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 -1 1 0 0 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 -1 0 1 1 1 1 1 0 0 0 1 0 1 1 1 1 1 1 1 1 1 -1 0 0 0 0 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 -1 1 1 1 0 1 1 1 0 0 1 0...
output:
-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 -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...
input:
output:
0 46501 922866 922355 673498 921844 261121 672987 203889 966301 107821 916734 170674 672476 497714 350035 128772 720510 497203 965790 736351 177317 486472 380184 92491 496692 323463 128261 917756 1021489 916223 336749 568232 866145 27594 915712 965279 683718 970389 818622 258055 215642 3066 56721 48...
result:
wrong answer 2nd lines differ - expected: '25855', found: '46501'