QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#420223#67. Two TransportationsBronya0 10ms3952kbC++203.0kb2024-05-24 15:32:422024-05-24 15:32:43

Judging History

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

  • [2024-05-24 15:32:43]
  • 评测
  • 测评结果:0
  • 用时:10ms
  • 内存:3952kb
  • [2024-05-24 15:32:42]
  • 提交

Azer

#include<bits/stdc++.h>
#include "Azer.h"

using namespace std;
struct edge{
	int obj;
	int last;
	int val;
}e[1000006];
int head[2005],g;
vector<int>dist; 
void link(int u,int v,int w){
	e[++g].obj=v;
	e[g].last=head[u];
	e[g].val=w;
	head[u]=g;
}
priority_queue<pair<int,int> >q;
bool pd[2005],op;
int rev,last=0,rec,sav;
pair<int,int> check(){
	while(!q.empty()&&pd[q.top().second])q.pop();
	if(!q.empty()){
        int x=q.top().second;
        return {dist[x]-last,x};
    }
	return {511,0};
}
void update(int u){
	pd[u]=true;last=dist[u];
	for(int i=head[u];i;i=e[i].last){
		int v=e[i].obj,w=e[i].val;
		if(dist[v]>dist[u]+w){
			dist[v]=dist[u]+w;
			q.push({-dist[v],v});
		}
	}
}
void Init(int x,int len){
	for(int i=len-1;i>=0;i--)SendA(x&(1<<i));
}
void InitA(int N,int M,vector<int>U,vector<int>V,vector<int>W){
	g=0;
	for(int i=0;i<N;i++)head[i]=0,pd[i]=false;
	dist.resize(N);
	for(int i=1;i<N;i++)dist[i]=1e9;
	for(int i=0;i<M;i++)link(U[i],V[i],W[i]),link(V[i],U[i],W[i]);
	while(!q.empty())q.pop();
	q.push({0,0});
	rev=9;op=0;rec=0;update(0);
	auto [len,u]=check();Init(len,9);
}
void ReceiveA(bool x){
	rec=(rec<<1)|(int)(x);rev--;
	if(!rev){
		auto [len,u]=check();
		if(!op){
			if(len<=rec){
				op=0,rev=9;rec=0;
				update(u);
				Init(u,11);Init(check().first,9);
			}
			else sav=rec,op=1,rev=11,rec=0;
		}
		else {
			dist[rec]=sav+last;
			update(rec);
			op=0;rev=9;rec=0;
			Init(check().first,9);
		}
	}
}
vector<int> Answer(){
    return dist;
}

Baijan

#include<bits/stdc++.h>
#include "Baijan.h"

using namespace std;
struct edge{
	int obj;
	int last;
	int val;
}e[1000006];
int head[2005],g;
vector<int>dist; 
void link(int u,int v,int w){
	e[++g].obj=v;
	e[g].last=head[u];
	e[g].val=w;
	head[u]=g;
}
priority_queue<pair<int,int> >q;
bool pd[2005],op;
int rev,last=0,rec,sav;
pair<int,int> check(){
	while(!q.empty()&&pd[q.top().second])q.pop();
	if(!q.empty()){
        int x=q.top().second;
        return {dist[x]-last,x};
    }
	return {511,0};
}
void update(int u){
	pd[u]=true;last=dist[u];
	for(int i=head[u];i;i=e[i].last){
		int v=e[i].obj,w=e[i].val;
		if(dist[v]>dist[u]+w){
			dist[v]=dist[u]+w;
			q.push({-dist[v],v});
		}
	}
}
void Init(int x,int len){
	for(int i=len-1;i>=0;i--)SendB(x&(1<<i));
}
void InitB(int N,int M,vector<int>U,vector<int>V,vector<int>W){
	g=0;
	for(int i=0;i<N;i++)head[i]=0,pd[i]=false;
	dist.resize(N);
	for(int i=1;i<N;i++)dist[i]=1e9;
	for(int i=0;i<M;i++)link(U[i],V[i],W[i]),link(V[i],U[i],W[i]);
	while(!q.empty())q.pop();
	q.push({0,0});
	rev=9;op=0;rec=0;update(0);
	auto [len,u]=check();Init(len,9);
}
void ReceiveB(bool x){
	rec=(rec<<1)|(int)(x);rev--;
	if(!rev){
		auto [len,u]=check();
		if(!op){
			if(len<rec){
				op=0,rev=9;rec=0;
				update(u);
				Init(u,11);Init(check().first,9);
			}
			else sav=rec,op=1,rev=11,rec=0;
		}
		else {
			dist[rec]=sav+last;
			update(rec);
			op=0;rev=9;rec=0;
			Init(check().first,9);
		}
	}
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

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

input:


output:


result:

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

Subtask #2:

score: 0
Wrong Answer

Test #7:

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

input:

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


result:

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

Subtask #3:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 7ms
memory: 3868kb

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

output:

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

input:


output:


result:

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

Subtask #4:

score: 0
Wrong Answer

Test #24:

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

input:

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

output:

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

input:

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

output:

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

input:


output:


result:

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

Subtask #6:

score: 0
Wrong Answer

Test #51:

score: 0
Wrong Answer
time: 4ms
memory: 3828kb

input:

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

output:

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

input:


output:


result:

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

Subtask #7:

score: 0
Wrong Answer

Test #64:

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

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

output:

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

input:


output:


result:

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