QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#692690 | #5520. Distance Parities | cxqghzj | WA | 0ms | 4032kb | C++14 | 2.2kb | 2024-10-31 14:54:51 | 2024-10-31 14:54:51 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <array>
#include <vector>
#include <bitset>
#define pii pair <int, int>
using namespace std;
#ifdef ONLINE_JUDGE
/* #define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++) */
/* char buf[1 << 23], *p1 = buf, *p2 = buf, ubuf[1 << 23], *u = ubuf; */
#endif
int read() {
int p = 0, flg = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') flg = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
p = p * 10 + c - '0';
c = getchar();
}
return p * flg;
}
void write(int x) {
if (x < 0) {
x = -x;
putchar('-');
}
if (x > 9) {
write(x / 10);
}
putchar(x % 10 + '0');
}
bool _stmer;
#define fi first
#define se second
const int N = 305;
array <bitset <N>, N> vis;
array <string, N> mp;
char strbuf[N];
void solve() {
vector <pii> ans;
int n = read();
vis.fill((bitset <N>)0);
for (int i = 1; i <= n; i++) {
scanf("%s", strbuf);
mp[i] = strbuf, mp[i] = " " + mp[i];
for (int j = 1; j <= n; j++)
if (mp[i][j] == '1' && !vis[i][j]) vis[i][j] = vis[j][i] = 1, ans.push_back(make_pair(i, j));
}
bool _flg = 0;
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) {
if (mp[i][j] == '0') {
bool flg = 0;
for (int k = 1; k <= n; k++)
flg |= i != k && j != k && mp[i][k] == mp[j][k] && mp[i][k] == '1';
if (!flg) _flg = 1;
}
}
}
if (_flg) puts("Track Lost");
else {
puts("Pure Memory");
write(ans.size()), puts("");
for (auto k : ans) {
write(k.fi), putchar(32);
write(k.se), puts("");
}
}
}
bool _edmer;
int main() {
cerr << (&_stmer - &_edmer) / 1024.0 / 1024.0 << "MB\n";
#ifndef cxqghzj
// freopen("bridge.in", "r", stdin);
// freopen("bridge.out", "w", stdout);
#endif
int T = read();
while (T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 4032kb
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)