QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#692701#5520. Distance Paritieszwh2008WA 0ms3636kbC++141.0kb2024-10-31 14:55:292024-10-31 14:55:42

Judging History

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

  • [2024-10-31 14:55:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3636kb
  • [2024-10-31 14:55:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using pi=pair<int,int>;
#define fi first
#define se second
const int N=505;
int n,d[N][N];
string a[N];
void bfs(int s,int *d) {
    queue<int>q;q.push(s),d[s]=0;
    while(q.size()) {
        int x=q.front();q.pop();
        for(int i=1;i<=n;i++)if(a[x][i]=='1'&&d[i]==-1)d[i]=d[x]+1,q.push(i);
    }
}
void solve() {
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i],a[i]=' '+a[i];
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)d[i][j]=-1;
    for(int i=1;i<=n;i++)bfs(i,d[i]);
    bool fl=1;
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)if(d[i][j]==-1||d[i][j]%2+'0'!=a[i][j])fl=0;
    if(!fl)cout<<"Track Lost\n";
    else {
        cout<<"Pure Memory\n";
        vector<pi>as;
        for(int i=1;i<=n;i++)for(int j=i+1;j<=n;j++)if(a[i][j]=='1')as.push_back({i,j});
        cout<<as.size()<<'\n';
        for(pi i:as)cout<<i.fi<<' '<<i.se<<'\n';
    }
}
int main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int tt;cin>>tt;
    while(tt--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3636kb

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)