QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#274208#67. Two TransportationsDaiRuiChen0070 9ms3932kbC++202.1kb2023-12-03 12:53:112023-12-03 12:53:11

Judging History

你现在查看的是最新测评结果

  • [2023-12-03 12:53:11]
  • 评测
  • 测评结果:0
  • 用时:9ms
  • 内存:3932kb
  • [2023-12-03 12:53:11]
  • 提交

Azer

#include<bits/stdc++.h>
#include "Azer.h"
using namespace std;
namespace {
const int inf=1e9;
int n,m,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;
namespace {
const int inf=1e9;
int n,m,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;
		}
	}
}

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: 3932kb

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: 1ms
memory: 3668kb

input:

-1

output:

-1
-1

input:


output:

0

result:

ok single line: '0'

Test #8:

score: 0
Wrong Answer
time: 1ms
memory: 3820kb

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: 1ms
memory: 3864kb

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: 1ms
memory: 3732kb

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: 3736kb

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: 3832kb

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: 9ms
memory: 3928kb

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'