QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#692848#5520. Distance ParitiesFelix72WA 0ms3660kbC++141.1kb2024-10-31 15:07:372024-10-31 15:07:48

Judging History

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

  • [2024-10-31 15:07:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3660kb
  • [2024-10-31 15:07:37]
  • 提交

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;
}
/*

*/

詳細信息

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)