QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#419864#67. Two Transportationscqbzly0 2ms4376kbC++203.1kb2024-05-24 12:06:502024-05-24 12:06:50

Judging History

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

  • [2024-05-24 12:06:50]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:4376kb
  • [2024-05-24 12:06:50]
  • 提交

Azer

#include<bits/stdc++.h>
#include "Azer.h"
#define fi first
#define se second
#define pb push_back
using namespace std;
const int N=2005;
namespace{
  int n,m,dis[N],vs[N],mx,val,lim=0,ps=0;
  vector<pair<int,int>>G[N];
  priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>q;
  bool op;
  void send(int x,int op){ 
    if(!op){
      for(int i=0;i<9;i++)SendA(x>>i&1);
    }
    else{
      for(int i=0;i<11;i++)SendA(x>>i&1);
    }
  }
  //op=0:??????? 
  //op=1:?????? 
  void work(int u,int x){
  	assert(u<n);
    dis[u]=x,vs[u]=1;
    for(auto e:G[u]){
      if(dis[u]+e.se<dis[e.fi]){
        dis[e.fi]=dis[u]+e.se;
        q.push({dis[e.fi],e.fi});
      }
    }
  }
}

void InitA(int nn,int A,vector<int>U,vector<int>V,vector<int>C){
	n=nn,m=A;
	for(int i=0;i<m;i++){
		G[U[i]].pb({V[i],C[i]});
		G[V[i]].pb({U[i],C[i]});
	}
	memset(dis,0x3f,sizeof dis),dis[0]=0;
	send(0,0);
	q.push({0,0});
}
void ReceiveA(bool x){
	if(x)ps+=(1<<lim);
	lim++;
	if(!op){
		if(lim==9){
			//??????????? 
			if(!q.size()||q.top().fi>ps){
				val=ps+mx,op^=1;
			}
			//?????????????????????????? 
			else{
				send(q.top().se,1);
				work(q.top().se,q.top().fi);
				while(q.size()&&vs[q.top().se])q.pop();
				q.size()?send(q.top().fi-mx,0):send(501,0);
			}
			lim=ps=0;
		}
	}
	else{
		if(lim==11){
			work(ps,val);
			while(q.size()&&vs[q.top().se])q.pop();
			q.size()?send(q.top().fi-mx,0):send(501,0);
			op^=1,lim=ps=0;
		}
	}
	
}
vector<int>Answer(){
	vector<int>res;
	for(int i=0;i<n;i++)res.pb(dis[i]);
	return res;
}

Baijan

#include<bits/stdc++.h>
#include "Baijan.h"
#define fi first
#define se second
#define pb push_back
using namespace std;
const int N=2005;
namespace{
  int n,m,dis[N],vs[N],mx,val,lim=0,ps=0;
  vector<pair<int,int>>G[N];
  priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>q;
  bool op;
  void send(int x,int op){ 
    if(!op){
      for(int i=0;i<9;i++)SendB(x>>i&1);
    }
    else{
      for(int i=0;i<11;i++)SendB(x>>i&1);
    }
  }
  //op=0:??????? 
  //op=1:?????? 
  void work(int u,int x){
  	assert(u<n);
    dis[u]=x,vs[u]=1;
    for(auto e:G[u]){
      if(dis[u]+e.se<dis[e.fi]){
        dis[e.fi]=dis[u]+e.se;
        q.push({dis[e.fi],e.fi});
      }
    }
  }
}
void InitB(int nn,int A,vector<int>U,vector<int>V,vector<int>C){
	n=nn,m=A;
	for(int i=0;i<m;i++){
		G[U[i]].pb({V[i],C[i]});
		G[V[i]].pb({U[i],C[i]});
	}
	memset(dis,0x3f,sizeof dis),dis[0]=0;
	send(0,0);
	q.push({0,0});
}
void ReceiveB(bool x){
	if(x)ps+=(1<<lim);
	lim++;
	if(!op){
		if(lim==9){
			//??????????? 
			if(!q.size()||q.top().fi>=ps){
				val=ps+mx,op^=1;
			}
			//?????????????????????????? 
			else{
				send(q.top().se,1);
				work(q.top().se,q.top().fi);
				while(q.size()&&vs[q.top().se])q.pop();
				q.size()?send(q.top().fi-mx,0):send(501,0);
			}
			lim=ps=0;
		}
	}
	else{
		if(lim==11){
			work(ps,val);
			while(q.size()&&vs[q.top().se])q.pop();
			q.size()?send(q.top().fi-mx,0):send(501,0);
			op^=1,lim=ps=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: 1ms
memory: 4292kb

input:

0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 -1
1 0 1 0 1 1 1 1 1 -1
1 0 1 0 1 1 1 1 1 -1
1 0 1 0 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 0 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0 1 0 1 -1
1 0 1 1 0 1 1 0 1 0 1 0 0 1 1 1 0 1 0 1 -1
1 0 0 0 1 1 0 0 0 1 0 1 1 1 1 1 0 1 0 0 -1
-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: '2417', found: '1061109567'

Subtask #2:

score: 0
Wrong Answer

Test #7:

score: 8
Accepted
time: 0ms
memory: 3888kb

input:

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

output:

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

input:


output:

0

result:

ok single line: '0'

Test #8:

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

input:

0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 -1
0 0 1 1 1 0 0 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 0 0 0 1 1 1 0 0 1 0 0 1 0 1 0 1 1 1 1 1 -1
-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: '128264', found: '1061109567'

Subtask #3:

score: 0
Wrong Answer

Test #14:

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

input:

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

output:

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

input:


output:

0
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
392
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
10611095...

result:

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

Subtask #4:

score: 0
Wrong Answer

Test #24:

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

input:

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

output:

-1
0 0 0 0 0 0 0 0 0 -1
1 1 0 0 1 0 0 1 0 1 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 0 0 1 1 -1
0 1 1 0 0 1 1 0 0 0 0 0 1 1 0 1 1 0 1 1 -1
-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: '1881', found: '1061109567'

Subtask #5:

score: 0
Wrong Answer

Test #38:

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

input:

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

output:

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

input:

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

output:

-1
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 1 -1
-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: '4745', found: '1061109567'

Subtask #7:

score: 0
Wrong Answer

Test #64:

score: 0
Wrong Answer
time: 2ms
memory: 4376kb

input:

0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 -1
0 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 0 1 -1
-1
-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 0 1 1 1 1 -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: '25855', found: '1061109567'