QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#419834#67. Two TransportationshxhhxhCompile Error//C++202.6kb2024-05-24 11:47:512024-05-24 11:47:51

Judging History

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

  • [2024-05-24 11:47:51]
  • 评测
  • [2024-05-24 11:47:51]
  • 提交

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;
bool vis[2222];
vector<pair<int,int> >e[2222];
void sd(int x,int l){
	x=min(x,(1<<l)-1);
//	cerr<<"A send "<<x<<" of len "<<l<<endl;
	for(int i=0;i<l;i++) SendA(x>>i&1);
//	cerr<<"A's send end\n"; 
}
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;
}
void nxt(){
	if(cnt==n) return;
	int x=0;
	for(int i=1;i<=n;i++) if(!vis[i]) if(dis[x]>dis[i]) x=i;
	assert(dis[x]>=nv);
	sd(dis[x]-nv,9);
	my=dis[x]-nv;
}
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;
	nxt(); 
}
void ReceiveA(bool X){
	nx|=X<<nl;
	nl++;
	if(op==0&&nl==9){
//		cerr<<"A rec "<<nx<<" of len 9\n";
		if(nx<my){
			nv+=nx;
			op=1;
		}
		else{
			nv+=my;
			int ox=0;
			for(int i=1;i<=n;i++) if(!vis[i]) if(dis[ox]>dis[i]) ox=i;
			assert(dis[ox]==nv);
			sd(ox,11);
			slv(ox);
		}
		nx=nl=0;
		return;
	}
	if(op==1&&nl==11){
//		cerr<<"A rec "<<nx<<" of len 11\n";
		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;
bool vis[2222];
vector<pair<int,int> >e[2222];
void sd(int x,int l){
	x=min(x,(1<<l)-1);
//	cerr<<"B send "<<x<<" of len "<<l<<endl;
	for(int i=0;i<l;i++) SendB(x>>i&1);
//	cerr<<"B's send end\n"; 
}
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 nxt(){
	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){
//		cerr<<"B rec "<<nx<<" of len 9\n";
		int ot=nxt();
		my=dis[ot]-nv;
		sd(my,9);
		if(nx<=my){
			nv+=nx;
			op=1;
		}
		else{
			nv+=my;
			sd(ot,11);
			slv(ot);
			op=0;
		}
		nx=nl=0;
		return;
	}
	if(op==1&&nl==11){
//		cerr<<"B rec "<<nx<<" of len 11\n";
		dis[nx]=nv;
		slv(nx);
		nx=nl=op=0;
	}
}

Details

grader_Azer.cpp: In function ‘int main(int, char**)’:
grader_Azer.cpp:37:13: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
   37 |   char *t = "/dev/null";
      |             ^~~~~~~~~~~
/usr/bin/ld: /tmp/ccHgyO5o.o: in function `main':
grader_Azer.cpp:(.text.startup+0x23d): undefined reference to `InitA(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status