QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#22602#2833. HamiltonLFCodeWA 1ms1992kbC++14931b2022-03-10 09:18:452022-04-30 01:27:22

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 01:27:22]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:1992kb
  • [2022-03-10 09:18:45]
  • 提交

answer

//什么时候我才能有杜爷一半强啊/kk
#include<cstdio>
const int N=2022;
int n,e[N][N],qh=10086,qt=10085,q[100086];
int read(){
	char ch=getchar();int nn=0,ssss=1;
	while(ch<'0'||ch>'9'){if(ch=='-')ssss*=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){nn=nn*10+(ch-'0');ch=getchar();};
	return nn*ssss;
}
int gn(){char ch=getchar();while(ch<'0'||ch>'1')ch=getchar();return ch='0';}
bool solve(){
	qh=10086;qt=10085;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			e[i][j]=gn();
	q[++qt]=1;q[++qt]=2;
	for(int i=3;i<=n;i++){
		if(e[q[qh]][i]){
			if(e[i][q[qt]]){
				q[--qh]=i;
				q[--qh]=q[qt];
				qt--;
			}
			else q[--qh]=i;
		}
		else{
			if(e[i][q[qh+1]]){
				q[++qt]=q[qh];
				q[qh]=i;
			}
			else{
				q[++qt]=i;
				q[++qt]=q[qh];
				qh++;
			}
		}
	}
	for(int i=qh;i<=qt;i++)printf("%d ",q[i]);
	puts("");return true;
}
int main(){
	while(~scanf("%d",&n))solve();
}

详细

Test #1:

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

input:

3
001
000
100
4
0000
0000
0000
0000

output:

2 3 1 
1 4 2 3 

result:

wrong answer case #1: found 2 indices