QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#419851#67. Two TransportationshxhhxhCompile Error//C++202.0kb2024-05-24 11:59:232024-05-24 11:59:24

Judging History

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

  • [2024-05-24 11:59:24]
  • 评测
  • [2024-05-24 11:59:23]
  • 提交

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;
	int 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

Azer.code: In function ‘void slv(int)’:
Azer.code:35:6: error: declaration of ‘int x’ shadows a parameter
   35 |  int x=fd();
      |      ^
Azer.code:31:14: note: ‘int x’ previously declared here
   31 | void slv(int x){
      |          ~~~~^
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";
      |             ^~~~~~~~~~~