QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#419856#67. Two Transportationshxhhxh0 15ms4220kbC++202.0kb2024-05-24 12:01:362024-05-24 12:01:37

Judging History

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

  • [2024-05-24 12:01:37]
  • 评测
  • 测评结果:0
  • 用时:15ms
  • 内存:4220kb
  • [2024-05-24 12:01:36]
  • 提交

Azer

#include<bits/stdc++.h>
#include"Azer.h"
#define fi first
#define se second
using namespace std;
int n,m,nv,dis[2222],op,nx,nl,my,cnt,ox;
bool vis[2222];
vector<pair<int,int> >e[2222];
void sd(int x,int l){
	x=min(x,(1<<l)-1);
	for(int i=0;i<l;i++) SendA(x>>i&1);
}
void InitA(int N,int A,vector<int>U,vector<int>V,vector<int>C){
	n=N,m=A;
	for(int i=0;i<m;i++) e[U[i]+1].push_back({V[i]+1,C[i]});
	for(int i=0;i<m;i++) e[V[i]+1].push_back({U[i]+1,C[i]});
	sd(0,9);
	memset(dis,0x3f,sizeof(dis));
	dis[1]=op=my=0;
}
vector<int>Answer(){
	vector<int>p;
	for(int i=1;i<=n;i++) p.push_back(dis[i]);
	return p;
}
int fd(){
	int x=0;
	for(int i=1;i<=n;i++) if(!vis[i]) if(dis[x]>dis[i]) x=i;
	return x;
}
void slv(int x){
	for(auto i:e[x]) if(dis[i.fi]>dis[x]+i.se) dis[i.fi]=dis[x]+i.se;
	cnt++,vis[x]=1;
	if(cnt==n) return;
	x=fd();
	sd(my=dis[x]-nv,9);
}
void ReceiveA(bool X){
	nx|=X<<nl;
	nl++;
	if(op==0&&nl==9){
		nx+=min(my,nx);
		if(nx<my) op=1;
		else sd(ox=fd(),11),slv(ox);
		nx=nl=0;
	}
	if(op==1&&nl==11) dis[nx]=nv,slv(nx),nx=nl=op=0;
}

Baijan

#include<bits/stdc++.h>
#include"Baijan.h"
#define fi first
#define se second
using namespace std;
int n,m,nv,dis[2222],op,nx,nl,my,cnt,ox;
bool vis[2222];
vector<pair<int,int> >e[2222];
void sd(int x,int l){
	x=min(x,(1<<l)-1);
	for(int i=0;i<l;i++) SendB(x>>i&1);
}
void InitB(int N,int B,vector<int>U,vector<int>V,vector<int>C){
	n=N,m=B;
	for(int i=0;i<m;i++) e[U[i]+1].push_back({V[i]+1,C[i]});
	for(int i=0;i<m;i++) e[V[i]+1].push_back({U[i]+1,C[i]});
	memset(dis,0x3f,sizeof(dis));
	dis[1]=op=my=0;
}
int fd(){
	int x=0;
	for(int i=1;i<=n;i++) if(!vis[i]) if(dis[x]>dis[i]) x=i;
	return x;
}
void slv(int x){
	for(auto i:e[x]) if(dis[i.fi]>dis[x]+i.se) dis[i.fi]=dis[x]+i.se;
	cnt++,vis[x]=1;
}
void ReceiveB(bool X){
	nx|=X<<nl,nl++;
	if(op==0&&nl==9){
		ox=fd();
		my=dis[ox]-nv;
		sd(my,9);
		nv+=min(nx,my);
		if(nx<=my) op=1;
		else sd(ox,11),slv(ox),op=0;
		nx=nl=0;
	}
	if(op==1&&nl==11) dis[nx]=nv,slv(nx),nx=nl=op=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: 15ms
memory: 3952kb

input:

0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 0 0 0 0 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
1 1 1 1 1 1 1 1 1 -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
0 0 1 0 1 1 0 1 0 1 0 1 0 1 0 0 1 1 0 0 -1
1 1 1 1 0 0 0 1 0 0 1 1 1 0 1 1 0 1 0 1 -1
1 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 0 1 0 -1
1 1 0 0 0 0 0 0 1 1 0 1 0 1 0 0 1 1 0 1 -1
1 1 0 1 1 0 1 0 0 1 1 0 0 0 1 1 0 0 0 0 -1
1 1 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 -1
1 1 0 0 0 1 0 0 0 ...

input:


output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 2nd lines differ - expected: '2417', found: '0'

Subtask #2:

score: 0
Wrong Answer

Test #7:

score: 8
Accepted
time: 1ms
memory: 3852kb

input:

0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 0 0 0 0 0 0 -1
-1

output:

-1
0 0 0 0 0 0 0 0 0 -1
-1
-1

input:


output:

0

result:

ok single line: '0'

Test #8:

score: 0
Wrong Answer
time: 9ms
memory: 4220kb

input:

0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 0 0 0 1 0 1 -1
0 1 1 0 1 0 0 1 0 1 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 0 0 0 0 1 0 -1
0 1 0 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 -1
0 1 0 1 1 1 1 1 0 -1
0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1
0 0 0 1 1 1 0 0 1 -1
0 0 1 1 0 1 0 1 0 0 1 1...

output:

-1
0 0 0 0 0 0 0 0 0 -1
1 0 1 0 1 0 1 1 0 1 0 0 1 1 1 0 0 1 0 0 -1
1 1 1 1 1 1 1 1 1 -1
0 0 0 0 1 0 0 0 1 1 0 1 1 0 0 1 1 0 1 0 -1
1 1 1 1 1 1 1 1 1 -1
0 0 1 0 0 1 1 1 1 0 1 1 0 0 1 0 0 1 0 1 -1
1 1 1 1 1 1 1 1 1 -1
0 1 0 0 1 0 1 1 1 1 1 0 0 0 1 0 1 1 0 1 -1
1 1 1 1 1 1 1 1 1 -1
1 0 0 0 0 0 1 0 1 1 ...

input:


output:

0
244
201
135
417
0
315
0
0
256
152
0
0
0
499
273
0
0
0
214
0
225
0
0
0
0
368
0
371
494
0
0
484
0
378
204
0
0
0
0
0
250
303
0
371
331
156
0
0
0
134
0
224
248
0
384
0
442
0
0
0
0
0
428
406
0
219
0
0
0
394
174
138
406
0
0
0
355
0
0
299
333
0
453
217
0
0
269
241
180
0
334
301
366
385
0
244
205
0
0
0
22...

result:

wrong answer 2nd lines differ - expected: '128264', found: '244'

Subtask #3:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 3ms
memory: 3856kb

input:

0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 -1
0 0 1 0 1 1 1 0 0 0 0 1 1 0 1 1 1 0 0 1 -1
1 1 1 0 1 1 0 0 1 -1
0 1 0 0 1 0 0 0 0 1 1 1 1 0 1 1 1 0 0 1 -1
1 0 0 1 1 1 0 0 1 -1
1 0 0 0 0 0 1 1 0 -1
1 0 0 0 0 0 1 1 0 -1
1 0 0 0 0 0 1 1 0 -1
1 1 1 0 1 0 0 1 0 1 0 0 1 0 0 1 1 1 1 0 0 0 0...

output:

-1
0 0 0 0 0 0 0 0 0 -1
1 0 1 0 0 1 0 1 1 -1
0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1 1 1 0 -1
1 1 0 1 1 1 1 1 0 0 0 1 1 0 1 0 0 0 1 1 -1
1 1 1 1 0 1 0 0 0 -1
1 0 1 1 1 0 0 0 0 0 1 0 0 1 0 1 1 0 1 1 -1
1 1 1 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 1 0 -1
1 1 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 -1
1 1 0 0 0 0 0 1 0 0...

input:


output:

0
286
0
0
1061109567
0
0
0
987
1061109567
0
1061109567
0
0
0
333
1061109567
0
1061109567
392
0
801
303
0
904
1061109567
0
195
0
265
395
1061109567
452
1206
0
1061109567
849
0
1061109567
1061109567
0
643
1061109567
0
585
197
1085
0
835
1061109567
1061109567
0
1061109567
0
0
258
0
1061109567
106110956...

result:

wrong answer 2nd lines differ - expected: '3328', found: '286'

Subtask #4:

score: 0
Wrong Answer

Test #24:

score: 0
Wrong Answer
time: 5ms
memory: 3824kb

input:

0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 0 1 0 1 0 0 1 -1
1 1 0 1 0 1 0 0 1 -1
0 1 0 1 0 0 0 1 0 0 0 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 1 1 0 0 0 1 1 0 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...

output:

-1
0 0 0 0 0 0 0 0 0 -1
1 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 -1
0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 1 0 0 0 0 -1
1 0 1 0 1 1 0 0 0 1 1 1 1 0 1 0 1 0 0 0 -1
1 1 0 1 0 0 0 0 1 0 1 0 1 1 1 0 0 0 0 0 -1
1 1 1 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 1 0 0 0 1 1 0 0 0 1 1 1 0 1 0 -1
0 0 1 1 1 0 0 0 0 1 0...

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #5:

score: 0
Wrong Answer

Test #38:

score: 0
Wrong Answer
time: 0ms
memory: 3904kb

input:

0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0 -1
1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 0 1 1 0 1 0 0 1 -1
1 0 1 1 0 1 0 0 1 -1
0 1 1 0 1 0 0 1 0 0 0 1 1 1 1 1 1 1 1 1 -1
1 0 1 0 1 1 0 0 1 1 0 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 1 0 1 0 1...

output:

-1
0 0 0 0 0 0 0 0 0 -1
1 1 1 1 1 1 1 1 1 -1
1 0 1 1 0 1 1 0 1 0 1 0 0 0 1 1 0 1 1 0 -1
0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 1 1 0 -1
0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 1 1 1 1 0 -1
1 1 1 1 1 1 1 1 1 -1
0 1 0 0 0 1 0 1 1 1 1 1 0 1 0 1 0 0 1 0 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
0 0 0 1 1 1 1 0 1 1 ...

input:


output:

0
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1...

result:

wrong answer 2nd lines differ - expected: '3467', found: '1061109567'

Subtask #6:

score: 0
Wrong Answer

Test #51:

score: 0
Wrong Answer
time: 6ms
memory: 3908kb

input:

0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
0 0 1 1 0 1 0 0 0 -1
1 0 0 0 0 0 0 0 0 -1
1 1 0 0 1 1 0 0 0 1 0 0 0 1 1 0 1 0 0 0 -1
0 1 1 0 1 1 0 0 1 1 0 1 0 1 1 1 0 1 0 1 -1
1 1 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 1 0 1 0 1 0 0 0 1 1 0 1 1 0 0 0 0 1 1 0 0 1 1 -1
1 0 ...

output:

-1
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 1 1 0 1 0 0 1 1 1 1 1 0 1 0 1 0 -1
0 1 0 1 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 -1
1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 1 1 0 -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 0 1 0 1 0 1 0 0 0 0 1 1 0 0 0 -1
1 1 0 1 1 1 1 0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 ...

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #7:

score: 0
Wrong Answer

Test #64:

score: 0
Wrong Answer
time: 9ms
memory: 4028kb

input:

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 1 1 1 1 1 -1
1 0 1 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 -1
0 0 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 -1
1 1 1 0 0 0 1 1 0 -1
1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 0 1 -1
0 0 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 0 0 0 0 1 0 1 1 1 -1
0 1...

output:

-1
0 0 0 0 0 0 0 0 0 -1
1 1 0 0 1 1 1 1 1 -1
1 1 0 0 1 1 1 1 1 0 0 1 0 1 1 0 0 0 0 1 -1
1 1 0 0 1 1 1 1 1 -1
1 1 1 1 1 1 0 1 1 -1
1 1 0 0 0 1 1 1 0 0 0 1 0 1 0 0 1 1 0 0 -1
0 0 1 0 1 0 0 0 0 0 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 1 1 1 1 1 0 0 1...

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''