QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#127650#6643. Graphs and Colorsxjsc01WA 1ms3608kbC++23669b2023-07-19 21:36:262023-07-19 21:36:26

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-19 21:36:26]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3608kb
  • [2023-07-19 21:36:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n, m;
int cal(int u, int v){
	int x = (u+1)>>1;
	int y = (v+1)>>1;
	if(n&1 == 1){
		if(u==n)return y;
		if(v==n)return x;
	}
	if(x == y) return x;
	if(x > m && y > m) return 0;
	else if(x > m) return y;
	else if(y > m) return x;
	if(((u&1) + (v&1)) %2 == 1){
		return max(x, y);
	}
	else{
		return min(x, y);
	}
}
int main()
{
	int T;
	cin >> T;
	while(T--){
		scanf("%d%d", &n, &m);
		if((n/2) < m){
			puts("NO");
			continue;
		}
		puts("YES");
		for(int i = 2; i <= n; i++){
			for(int j = 1; j < i; j++){
				printf("%d ", cal(i, j));
			}
			puts("");
		}
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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 2 
1 1 0 0 
1 1 0 0 3 
1 1 0 0 0 0 
1 1 0 0 0 0 4 
1 1 0 0 0 0 0 0 
1 1 0 0 0 0 0 0 5 
1 1 0 0 0 0 0 0 0 0 
1 1 0 0 0 0 0 0 0 0 6 
NO
NO
NO
NO
NO
YES
1 
1 2 
2 1 2 
1 1 2 2 
1 1 2...

result:

wrong answer Integer parameter [name=col] equals to 2, violates the range [1, 1] (test case 36)