QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#692848 | #5520. Distance Parities | Felix72 | WA | 0ms | 3660kb | C++14 | 1.1kb | 2024-10-31 15:07:37 | 2024-10-31 15:07:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 510;
int T, n; bool mp[N][N]; int dis[N][N];
inline void sol()
{
cin >> n; int cnt = 0;
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= n; ++j)
mp[i][j] = false;
for(int i = 1; i <= n; ++i)
{
for(int j = 1; j <= n; ++j)
{
char c; cin >> c;
mp[i][j] = c - '0';
if(mp[i][j]) dis[i][j] = 1, cnt += (i < j);
else if(i != j) dis[i][j] = 1e9;
else dis[i][j] = 0;
}
}
for(int k = 1; k <= n; ++k)
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= n; ++j)
dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= n; ++j)
if(dis[i][j] > n || (dis[i][j] & 1) != mp[i][j])
{cout << "Track Lost" << '\n'; return ;}
cout << "Pure Memory" << '\n';
cout << cnt << '\n';
for(int i = 1; i <= n; ++i)
for(int j = i + 1; j <= n; ++j)
if(mp[i][j])
cout << i << " " << j << '\n';
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> T;
while(T--) sol();
return 0;
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3660kb
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)