QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#260762 | #6643. Graphs and Colors | ucup-team1198# | WA | 1ms | 3636kb | C++20 | 1.1kb | 2023-11-22 14:57:42 | 2023-11-22 14:57:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define ld long double
#define all(a) (a).begin(), (a).end()
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
int n, k;
cin >> n >> k;
if (k > n / 2) {
cout << "NO\n";
continue;
}
cout << "YES\n";
vector<vector<int>> tab(n, vector<int>(n, -2));
int n1 = n - (n % 2);
for (int i = 0; i < n1; i += 2) {
tab[i][i + 1] = i / 2;
for (int j = 0; j < i; j += 2) {
tab[j + 1][i] = i / 2;
tab[j][i + 1] = i / 2;
}
for (int j = i + 2; j < n1; j += 2) {
tab[i][j] = i / 2;
tab[i + 1][j + 1] = i / 2;
}
}
if (n1 != n) {
for (int i = 0; i < n1; ++i) {
tab[i][n - 1] = i / 2;
}
}
for (int i = 1; i < n; ++i) {
for (int j = 0; j < i; ++j) {
// cout << min(tab[j][i], k - 1) + 1 << ' ';
cout << tab[j][i] + 1 << ' ';
}
cout << '\n';
}
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3636kb
input:
768 8 24 7 20 17 61 17 76 16 100 16 16 15 59 9 17 14 31 14 61 10 32 17 55 5 7 10 29 14 82 13 47 17 32 5 10 16 76 14 59 8 28 13 19 12 41 13 41 11 32 11 53 3 2 16 52 16 87 7 12 9 15 15 65 15 53 17 47 6 15 12 1 14 35 16 60 12 31 14 70 15 88 12 2 8 23 12 38 16 111 16 117 5 4 14 90 12 55 15 41 15 48 15 4...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 1 1 2 2 1 2 1 3 2 3 3 1 3 2 3 1 4 2 4 3 4 4 1 4 2 4 3 4 1 5 2 5 3 5 4 5 5 1 5 2 5 3 5 4 5 1 6 2 6 3 6 4 6 5 6 6 1 6 2 6 3 6 4 6 5 6 NO NO NO NO NO YES 1 1 2 2 1 2 1 3 2 3 3 1 3...
result:
wrong answer Integer parameter [name=col] equals to 2, violates the range [1, 1] (test case 36)