QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#135100 | #6643. Graphs and Colors | SolitaryDream# | WA | 0ms | 3652kb | C++20 | 913b | 2023-08-05 11:30:35 | 2023-08-05 11:30:38 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e2+1e1+7;
int T,n,k;
int ans[N][N];
int main()
{
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&n,&k);
if(k*(n-1)>n*(n-1)/2)
{
puts("NO");
continue;
}
for(int i=1;i+1<=n;i+=2)
{
ans[i][i+1]=ans[i+1][i]=i;
for(int j=1;j<i;j+=2)
{
ans[i][j]=ans[i+1][j+1]=i;
ans[j][i]=ans[j+1][i+1]=i;
ans[i+1][j]=ans[i][j+1]=j;
ans[j][i+1]=ans[j+1][i]=j;
}
}
if(n%2==1)
{
for(int i=1;i+1<=n;i+=2)
ans[n][i]=ans[n][i+1]=i;
}
puts("YES");
for(int i=1;i<=n;i++)
for(int j=1;j<i;j++)
printf("%d%c",min(ans[i][j],k)," \n"[j+1==i]);
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3652kb
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 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 NO NO NO NO NO YES 1 2 1 1 2 2 2 1 2 2 1 2 2 2 2 2 1 2 2 2 ...
result:
wrong answer Graph is not correct (test case 52)