QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#692268 | #5520. Distance Parities | CEFqwq | WA | 1ms | 4868kb | C++14 | 1.2kb | 2024-10-31 14:14:16 | 2024-10-31 14:14:20 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int T, n, m;
string s[505];
int dis[505][505];
vector<int> G[505];
queue<int> q;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin >> T;
while (T--){
m = 0;
cin >> n;
for (int i = 1; i <= n; i++){
G[i].clear();
cin >> s[i];
s[i] = " " + s[i];
}
for (int i = 1; i <= n; i++)
for (int j = i + 1; j <= n; j++)
if (s[i][j] == '1'){
G[i].push_back(j);
G[j].push_back(i);
}
memset(dis, -1, sizeof dis);
for (int i = 1; i <= n; i++){
q.push(i);
dis[i][i] = 0;
while (!q.empty()){
int u = q.front();
q.pop();
for (auto v : G[u])
if (dis[i][v] == -1){
dis[i][v] = dis[i][u] + 1;
q.push(v);
}
}
}
bool chk = 0;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++){
if (dis[i][j] == -1 || dis[i][j] & 1 != s[i][j] - '0')
chk = 1;
}
if (chk == 1)
cout << "Track Lost\n";
else{
cout << "Pure Memory\n";
for (int i = 1; i <= n; i++)
for (auto v : G[i])
if (v > i)
m++;
cout << m << "\n";
for (int i = 1; i <= n; i++)
for (auto v : G[i])
if (v > i)
cout << i << " " << v << "\n";
}
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4868kb
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)