QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#694683 | #5520. Distance Parities | lin1991122 | WA | 0ms | 4060kb | C++14 | 1.1kb | 2024-10-31 18:27:40 | 2024-10-31 18:27:57 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
const int N=5e2+3;
int g[N][N];
int n;
bool f[N][N];
void solve(){
cin>>n;int cnt=0;
for(int i=1;i<=n;++i){
string s;cin>>s;s="#"+s;
for(int j=1;j<=n;++j){
g[i][j]=(s[j]=='1'?1:INF);
f[i][j]=(s[j]=='1');
cnt+=f[i][j];
}
}
for(int k=1;k<=n;++k)
for(int i=1;i<=n;++i)
for(int j=1;j<=n;++j)
g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
for(int i=1;i<=n;++i)
for(int j=1;j<=n;++j)
if(g[i][j]==INF||g[i][j]%2!=f[i][j]){
puts("Track Lost");return;
}
printf("Pure Memory\n%d\n",cnt/2);
for(int i=1;i<=n;++i)
for(int j=i+1;j<=n;++j)
if(f[i][j])printf("%d %d\n",i,j);
}
int main(){
int u,v,w,x,y,z;
// freopen("bridge.in","r",stdin);
// freopen("bridge.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int T;for(cin>>T;T--;)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 4060kb
input:
3 3 011 101 110 4 0100 1000 0001 0010 5 01010 10101 01010 10101 01010
output:
Pure Memory 3 1 2 1 3 2 3 Track Lost Pure Memory 6 1 2 1 4 2 3 2 5 3 4 4 5
result:
wrong answer Token parameter [name=yes/no] equals to "Pure", doesn't correspond to pattern "[yY][eE][sS]|[nN][oO]" (test case 1)