QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#273412#67. Two TransportationsDaiRuiChen0070 1ms3856kbC++202.0kb2023-12-02 23:43:142023-12-02 23:43:15

Judging History

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

  • [2023-12-02 23:43:15]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3856kb
  • [2023-12-02 23:43:14]
  • 提交

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);
				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);
				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: 3856kb

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: 0ms
memory: 3760kb

input:

-1

output:

-1
-1

input:


output:

0

result:

ok single line: '0'

Test #8:

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

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

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

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

input:


output:


result:

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