QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#43953#67. Two Transportations8192379812Compile Error//C++203.4kb2022-08-11 21:34:072023-01-15 11:53:19

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-15 11:53:19]
  • 评测
  • [2022-08-11 21:34:07]
  • 提交

Azer

#include "A.h"
#include <bits/stdc++.h>
namespace
{
constexpr int N(2005),L(511),M(1e6+5);
int head[N],to[M],nxt[M],len[M],e_cnt;
void addedge(int u,int v,int w){to[++e_cnt]=v,nxt[e_cnt]=head[u],len[e_cnt]=w,head[u]=e_cnt;}
int n,dis[N],cnt,pre;
bool vis[N];
struct node{int id,dis;node(void){}node(int i,int d):id(i),dis(d){}bool operator<(const node &o)const{return dis>o.dis;}};
std::priority_queue<node> Q;
typedef std::vector<int> vec;
void send(int val,int bits)
{
	for(int i(bits-1);~i;--i)
		SendA((val>>i)&1);
}
int val_now,val_cnt,sta,update_dis;
void init(void)
{
	if(cnt==n)
	{
		Answer();
		return;
	}
	while(Q.size()&&vis[Q.top().id])
		Q.pop();
	if(Q.size())
		send(Q.top().dis-pre,9);
	else
		send(L,9);
	sta=1;
}
void relax(int u)
{
	++cnt,vis[u]=1;
	pre=dis[u];
	for(int e(head[u]),v(to[e]);e;v=to[e=nxt[e]])
	if(dis[v]>dis[u]+len[e])
		Q.emplace(v,dis[v]=dis[u]+len[e]);
}
}
void InitA(int _n,int m,vec u,vec v,vec w)
{
	n=_n;
	for(int i(0);i<m;++i)
		addedge(u[i],v[i],w[i]),addedge(v[i],u[i],w[i]);
	memset(dis,0x3f,n*sizeof(int)),dis[0]=0;
	Q.emplace(0,0);
	init();
}
void ReceiveA(bool x)
{
	val_now=val_now<<1|x,++val_cnt;
	if(sta==1)
	{
		if(val_cnt<9)
			return;
		val_cnt=0;
		while(Q.size()&&vis[Q.top().id])
			Q.pop();
		if(val_now==L)
		{
			send(Q.top().id,11);
			relax(Q.top().id);
			init();
		}
		else
		{
			val_now+=pre;
			if(Q.size()&&Q.top().dis<=val_now)
			{
				send(Q.top().id,11);
				relax(Q.top().id);
				init();
			}
			else
				update_dis=val_now,sta=2;
		}
		val_now=0;
	}
	else if(sta==2)
	{
		if(val_cnt<11)
			return;
		val_cnt=0;
		dis[val_now]=update_dis;
		relax(val_now);
		val_now=0;
		init();
	}
}
vec Answer(void){return vec(dis,dis+n);}

Baijan

#include "B.h"
#include <bits/stdc++.h>
namespace
{
constexpr int N(2005),L(511),M(1e6+5);
int head[N],to[M],nxt[M],len[M],e_cnt;
void addedge(int u,int v,int w){to[++e_cnt]=v,nxt[e_cnt]=head[u],len[e_cnt]=w,head[u]=e_cnt;}
int n,dis[N],cnt,pre;
bool vis[N];
struct node{int id,dis;node(void){}node(int i,int d):id(i),dis(d){}bool operator<(const node &o)const{return dis>o.dis;}};
std::priority_queue<node> Q;
typedef std::vector<int> vec;
void send(int val,int bits)
{
	for(int i(bits-1);~i;--i)
		SendB((val>>i)&1);
}
int val_now,val_cnt,sta,update_dis;
void init(void)
{
	if(cnt==n)
		return;
	while(Q.size()&&vis[Q.top().id])
		Q.pop();
	if(Q.size())
		send(Q.top().dis-pre,9);
	else
		send(L,9);
	sta=1;
}
void relax(int u)
{
	++cnt,vis[u]=1;
	pre=dis[u];
	for(int e(head[u]),v(to[e]);e;v=to[e=nxt[e]])
	if(dis[v]>dis[u]+len[e])
		Q.emplace(v,dis[v]=dis[u]+len[e]);
}
}
void InitB(int _n,int m,vec u,vec v,vec w)
{
	n=_n;
	for(int i(0);i<m;++i)
		addedge(u[i],v[i],w[i]),addedge(v[i],u[i],w[i]);
	memset(dis,0x3f,n*sizeof(int)),dis[0]=0;
	Q.emplace(0,0);
	init();
}
void ReceiveB(bool x)
{
	val_now=val_now<<1|x,++val_cnt;
	if(sta==1)
	{
		if(val_cnt<9)
			return;
		val_cnt=0;
		while(Q.size()&&vis[Q.top().id])
			Q.pop();
		if(val_now==L)
		{
			send(Q.top().id,11);
			relax(Q.top().id);
			init();
		}
		else
		{
			val_now+=pre;
			if(Q.size()&&Q.top().dis<val_now)
			{
				send(Q.top().id,11);
				relax(Q.top().id);
				init();
			}
			else
				update_dis=val_now,sta=2;
		}
		val_now=0;
	}
	else if(sta==2)
	{
		if(val_cnt<11)
			return;
		val_cnt=0;
		dis[val_now]=update_dis;
		relax(val_now);
		val_now=0;
		init();
	}
}

Details

Azer.code:1:10: fatal error: A.h: No such file or directory
    1 | #include "A.h"
      |          ^~~~~
compilation terminated.
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";
      |             ^~~~~~~~~~~