QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#497629#7926. Color Inversion on a Huge ChessboardCUHK_723WA 1ms5648kbC++141.0kb2024-07-29 15:19:502024-07-29 15:19:51

Judging History

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

  • [2024-07-29 15:19:51]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5648kb
  • [2024-07-29 15:19:50]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	if(ch < '0' || ch > '9') {
		if(ch == '-') f = -1;
		ch = getchar();
	}
	if(ch >= '0' && ch <= '9') {
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return x * f;
}
int n, q, L, R;
int c[500010], r[500010];
int main() {
	n = read();
	q = read();
	L = n, R = n;
	for(int i = 1; i <= n; ++i) {
		c[i] = i % 2;
		r[i] = i % 2;
	} 
	int x;
	string k; 
	for(int i = 1; i <= q; ++i) {
		cin >> k;
		x = read();
		if(k[0] == 'R') {
			if(r[x] == 1) r[x] = 0;
			else r[x] = 1;
			if(x >= 2) {
				if(r[x] == r[x - 1]) L -= 1;
				else L += 1;
			}
			if(x + 1 <= n) {
				if(r[x] == r[x + 1]) L -= 1;
				else L += 1;
			}
		}
		else {
			if(c[x] == 1) c[x] = 0;
			else c[x] = 1;
			if(x >= 2) {
				if(c[x] == c[x - 1]) R -= 1;
				else R += 1;
			}
			if(x + 1 <= n) {
				if(c[x] == c[x + 1]) R -= 1;
				else R += 1;
			}
		}
		cout << (long long)L * R << endl;
	}
	
	
	
	
	
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 5648kb

input:

3 3
ROW 2
COLUMN 3
ROW 2

output:

3
2
6

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3540kb

input:

200000 2
ROW 1
ROW 1

output:


result:

wrong answer 1st lines differ - expected: '39999800000', found: ''