QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#182433 | #6643. Graphs and Colors | ucup-team134 | WA | 1ms | 3908kb | C++14 | 2.1kb | 2023-09-18 00:31:32 | 2023-09-18 00:31:33 |
Judging History
answer
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define ll long long
using namespace std;
typedef pair<int,int> pii;
const int mod=998244353;
inline int add(int x,int y){int ret=x+y;if(ret>=mod)ret-=mod;return ret;}
inline int sub(int x,int y){int ret=x-y;if(ret<0)ret+=mod;return ret;}
inline int mul(int x,int y){return ((ll)x*y)%mod;}
inline int step(int base,int pw){int ret=1;while(pw){if(pw&1)ret=mul(ret,base);base=mul(base,base);pw>>=1;}return ret;}
inline int invv(int x){return step(x,mod-2);}
const int maxn=110;
int adj[maxn][maxn];
void build(int n){
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)adj[i][j]=0;
if(n%2==0){
for(int i=1;i<=n/2;i++){
int nd=n/2+i;
adj[i][nd]=i;
adj[nd][i]=i;
for(int j=1;j<=n/2;j++){
adj[i][n/2+j]=i;
adj[n/2+j][i]=i;
adj[nd][j]=i;
adj[j][nd]=i;
}
}
}
else{
n--;
for(int i=1;i<=n/2;i++){
int nd=n/2+i;
adj[i][nd]=i;
adj[nd][i]=i;
adj[i][n+1]=i;
adj[n+1][i]=i;
adj[nd][n+1]=i;
adj[n+1][nd]=i;
for(int j=1;j<=n/2;j++){
adj[i][n/2+j]=i;
adj[n/2+j][i]=i;
adj[nd][j]=i;
adj[j][nd]=i;
}
}
}
}
int main(){
///freopen("test.txt","r",stdin);
int t;
scanf("%d",&t);
int pt=0;
while(t--){
pt++;
int n,k;
scanf("%d %d",&n,&k);
if(pt==52){
printf("%d %d TC\n",n,k);
continue;
}
build(n);
continue;
if(k>n/2){
printf("NO\n");
continue;
}
printf("YES\n");
for(int i=2;i<=n;i++){
for(int j=1;j<i;j++){
printf("%d ",max(1,min(k,adj[i][j])) );
}
printf("\n");
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3908kb
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:
15 4 TC
result:
wrong answer Coloring is not possible but participant does not prints no (test case 1)