QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#497629 | #7926. Color Inversion on a Huge Chessboard | CUHK_723 | WA | 1ms | 5648kb | C++14 | 1.0kb | 2024-07-29 15:19:50 | 2024-07-29 15:19:51 |
Judging History
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: ''