QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#127612 | #6643. Graphs and Colors | YZYxx694 | WA | 0ms | 3424kb | C++14 | 1.2kb | 2023-07-19 20:40:03 | 2023-07-19 20:40:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 105;
const ll INF = 1ll << 60, mod = 1e9 + 7;
int n, k, t;
int f[N][N];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> t;
while (t--)
{
cin >> n >> k;
int m = n / 2;
if (k > m)
{
puts("NO");
continue;
}
for (int i = 1; i <= m; i++)
{
f[i * 2 - 1][i * 2] = i;
}
for (int i = 1; i <= m; i++)
{
for (int j = i + 1; j <= m; j++)
{
f[i * 2 - 1][j * 2 - 1] = i;
f[i * 2][j * 2] = i;
f[i * 2 - 1][j * 2] = j;
f[i * 2][j * 2 - 1] = j;
}
}
if (n & 1)
{
for (int i = 1; i <= n - 1; i++)
f[i][n] = (i + 1) / 2;
}
puts("YES");
for (int i = 2; i <= n; i++)
{
for (int j = 1; j < i; j++)
{
cout << min(f[j][i], k) << " \n"[j == i - 1];
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3424kb
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:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 1 2 2 1 2 1 3 2 3 3 1 3 2 3 1 4 2 ...
result:
wrong answer Coloring is not possible but participant does not prints no (test case 1)