QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#466234#6644. Red Black Griducup-team191#WA 0ms3824kbC++231.5kb2024-07-07 17:06:222024-07-07 17:06:22

Judging History

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

  • [2024-07-07 17:06:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3824kb
  • [2024-07-07 17:06:22]
  • 提交

answer

#include <cstdio>
#include <vector>

#define X first
#define Y second
#define PB push_back

using namespace std;

typedef pair < int, int > pii;

const int N = 1e3 + 50;

vector < pii > v;

int A[N][N], n, k;

char zn[2] = {'R', 'B'};

void solve() {
	int flip = 0;
	scanf("%d%d", &n, &k);
	if(k > n * (n - 1)) {
		flip = 1;
		k = 2 * n * (n - 1) - k;
	}
	for(int i = 0;i < n;i++)
		for(int j = 0;j < n;j++)
			A[i][j] = 0;
	if(k == 1) {
		printf("NO\n");
		return;
	} 
	if(n == 1) {
		A[0][0] = 0;
	} else if(n == 2) {
		if(k == 2){
			A[1][0] = 1;
			A[1][1] = 1;
		}
	} else if(n == 3) {
		if(k == 2) {
			A[0][0] = 1;
		} else if(k == 3) {
			A[0][1] = 1;
		} else if(k == 4) {
			A[0][0] = 1;
			A[2][2] = 1;
		} else if(k == 5) {
			A[0][0] = 1;
			A[2][1] = 1;
		} else if(k == 6) {
			A[0][1] = 1;
			A[1][0] = 1;
		}
	} else {
		if(k % 4 == 0 && k > 0) {
			A[0][0] = 1; A[n - 1][n - 1] = 1;
			k -= 4;
		}
		if(k % 4 == 1) {
			A[0][0] = 1; A[0][2] = 1;
			k -= 4;
		} else if(k % 4 == 2) {
			A[0][0] = 1;
		} else if(k % 4 == 3) {
			A[0][2] = 1;
		}
		k -= k % 4;
		for(int i = 1;i + 1 < n;i++) {
			for(int j = 1;j + 1 < n;j++)
				if((i + j) % 2 == 0 && k > 0) {
					A[i][j] = 1; k -= 4;
				}
		}
		if(k > 0) {
			printf("koji kurac\n");
		}
	}
	printf("YES\n");
	for(int i = 0;i < n;i++) {
		for(int j = 0;j < n;j++)
			printf("%c", zn[(flip ? (i + j) % 2 : 0) ^ A[i][j]]);
		printf("\n");
	}
}

int main() {
	int T; scanf("%d", &T);
	for(;T--;) solve();
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3824kb

input:

2
3 6
3 1

output:

YES
RBR
BRR
RRR
NO

result:

wrong answer Condition failed: "A == B" (test case 1)