QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#135334 | #6643. Graphs and Colors | Vengeful_Spirit# | WA | 1ms | 3672kb | C++20 | 966b | 2023-08-05 13:51:13 | 2023-08-05 13:51:16 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int ans[200][200];
int main(){
int T;
scanf("%d",&T);
while(T--){
int n,k;
scanf("%d%d",&n,&k);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)ans[i][j]=0;
}
if(k==1){
puts("YES");
for(int i=1;i<n;i++){
for(int j=0;j<n;j++){
if(i>j){
printf("%d ",1);
}
}
puts("");
}
continue;
}
if((n-1)<=k*2){
if(n==5&&k==2){
puts("YES");
puts("1 ");
puts("2 1 ");
puts("2 2 1 ");
puts("1 2 2 1 ");
}
else puts("NO");
}
else{
puts("YES");
int m=n-1;
for(int i=0;i<m;i++){
int id=i%k;
ans[i][m]=ans[m][i]=id;
for(int j=(id+1)*k;j<(id+2)*(k);j++){
int col=i%k;
ans[i][j%m]=ans[j%m][i]=col;
}
}
for(int i=1;i<n;i++){
for(int j=0;j<n;j++){
if(i>j){
printf("%d ",ans[i][j]+1);
}
}
puts("");
}
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3672kb
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 1 1 1 1 1 1 2 1 1 1 2 1...
result:
wrong answer Graph is not correct (test case 42)