QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#181936#6643. Graphs and Colorsucup-team134WA 1ms3772kbC++141.1kb2023-09-17 04:49:462023-09-17 04:49:46

Judging History

你现在查看的是最新测评结果

  • [2023-09-17 04:49:46]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3772kb
  • [2023-09-17 04:49:46]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define pb push_back

const int N=105;
int ans[N][N];

void AddEdge(int u,int v,int col){
	if(ans[u][v]!=0){
		printf("u:%i v:%i ans:%i col:%i!!!!\n",u,v,ans[u][v],col);
	}
	ans[u][v]=ans[v][u]=col;
}
int main(){
	int t;
	scanf("%i",&t);
	while(t--){
		int n,k;
		scanf("%i %i",&n,&k);
		if((n-1)/k<k){
			printf("NO\n");
		}else{
			for(int i=1;i<=n;i++){
				for(int j=1;j<=n;j++){
					ans[i][j]=0;
				}
			}
			vector<vector<int>> g(k);
			int now=0;
			for(int i=2;i<=n;i++){
				g[now].pb(i);
				now=(now+1)%k;
			}
			for(int col=1;col<=k;col++){
				for(int i=0;i<k;i++){
					AddEdge(1,g[i][col-1],col);
					for(int j=0;j<col-1;j++){
						AddEdge(g[i][col-1],g[(i+1)%k][j],col);
					}
					for(int j=col;j<g[i].size();j++){
						AddEdge(g[i][col-1],g[i][j],col);
					}
				}
			}
			for(int i=1;i<=n;i++){
				for(int j=1;j<=n;j++){
					if(ans[i][j]==0){
						ans[i][j]=1;
					}
				}
			}
			printf("YES\n");
			for(int i=2;i<=n;i++){
				for(int j=1;j<i;j++){
					printf("%i ",ans[i][j]);
				}
				printf("\n");
			}
		}
	}
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3772kb

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 
2 1 2 
2 2 1 1 
1 1 1...

result:

wrong answer Coloring is possible but participant did not find it (test case 52)