QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#22602 | #2833. Hamilton | LFCode | WA | 1ms | 1992kb | C++14 | 931b | 2022-03-10 09:18:45 | 2022-04-30 01:27:22 |
Judging History
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();
}
Details
Tip: Click on the bar to expand more detailed information
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