QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#692409 | #5520. Distance Parities | georgeyucjr | WA | 0ms | 3780kb | C++17 | 1.0kb | 2024-10-31 14:28:24 | 2024-10-31 14:28:32 |
Judging History
answer
# include<bits/stdc++.h>
using namespace std;
# define rep(i, f, t, ...) for (int i = f, ##__VA_ARGS__; i <= t; ++i)
# define per(i, f, t, ...) for (int i = f, ##__VA_ARGS__; i >= t; --i)
# define SZ(x) int(x.size())
# define ALL(x) x.begin(), x.end()
# define FILEIO(fn) freopen(fn".in", "r", stdin), freopen(fn".out", "w", stdout)
signed main() {
// FILEIO("bridge");
cin.tie(0) -> sync_with_stdio(0);
auto solve = [&]() {
int n; cin >> n;
vector<vector<int> > a(n, vector<int>(n, 0));
rep(i, 0, n - 1) rep(j, 0, n - 1) { char x; cin >> x, a[i][j] = x - '0'; }
rep(i, 0, n - 1) rep(j, i + 1, n - 1) if (!a[i][j]) {
bool flg = false; rep(k, 0, n - 1) if (i != k && j != k)if (a[i][k] && a[j][k]) {flg = true; break;}
if (!flg)return cout << "Yes\n", void();
} vector<pair<int, int>>ans; cout << "Yes\n"; rep(i, 0, n - 1)rep(j, i + 1, n - 1)if (a[i][j])ans.emplace_back(i + 1, j + 1);
cout << SZ(ans) << "\n"; for (auto && [u, v] : ans)cout << u << " " << v << "\n";
}; int T; cin >> T; while (T--) solve();
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3780kb
input:
3 3 011 101 110 4 0100 1000 0001 0010 5 01010 10101 01010 10101 01010
output:
Yes 3 1 2 1 3 2 3 Yes Yes 6 1 2 1 4 2 3 2 5 3 4 4 5
result:
wrong output format Expected integer, but "Yes" found (test case 2)