QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#692306#5520. Distance Paritiescmk666WA 0ms3676kbC++231.1kb2024-10-31 14:17:542024-10-31 14:18:00

Judging History

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

  • [2024-10-31 14:18:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3676kb
  • [2024-10-31 14:17:54]
  • 提交

answer

#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
using namespace std; using ll = long long;
#define For(i, j, k) for ( int i = (j) ; i <= (k) ; i++ )
#define Fol(i, j, k) for ( int i = (j) ; i >= (k) ; i-- )
constexpr int inf = numeric_limits < int >::max() >> 1;
int n, m, a[509][509], b[509][509]; char c;
inline void work()
{
	cin >> n, m = 0;
	For(i, 1, n) For(j, 1, n) cin >> c, a[i][j] = c - '0';
	For(i, 1, n) For(j, 1, n) m += a[i][j], b[i][j] = a[i][j] ? 1 : i == j ? 0 : inf;
	For(k, 1, n) For(i, 1, n) if ( i != k ) For(j, 1, n) if ( i != j && j != k )
		b[i][j] = min(b[i][j], b[i][k] + b[k][j]);
	For(i, 1, n) For(j, 1, n)
		if ( b[i][j] == inf || a[i][j] != ( b[i][j] & 1 ) ) { cout << "Track Lost\n"; return; }
	cout << "Pure Memory\n" << ( m >> 1 ) << '\n';
	For(i, 1, n) For(j, i + 1, n) if ( a[i][j] ) cout << i << ' ' << j << '\n';
}
int main()
{
	// freopen("bridge.in", "r", stdin), freopen("bridge.out", "w", stdout);
	cin.tie(nullptr) -> sync_with_stdio(false);
	int t; cin >> t; while ( t-- ) work(); return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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)