QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#552992 | #7926. Color Inversion on a Huge Chessboard | deepthought | WA | 1ms | 4672kb | C++23 | 1.5kb | 2024-09-08 05:06:38 | 2024-09-08 05:06:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, q;
cin >> n >> q;
vector <int> r(n + 1, 0);
vector <int> c(n + 1, 0);
for(int i = 1; i <= n; i += 2) {r[i] = 1; c[i] = 1;}
ll x = n;
ll y = n;
while(q--) {
string s;
int num;
cin >> s >> num;
if(n == 1) {
cout << 1 << '\n';
continue;
}
if(s[0] == 'R') {
if(num == 1) {
if(r[0] == r[1]) x++;
else x--;
}
else if(num == n) {
if(r[n - 1] == r[n]) x++;
else x--;
}
else {
if(r[num + 1] == r[num - 1]) {
if(r[num + 1] == r[num]) x += 2;
else x -= 2;
}
}
r[num] = 1 - r[num];
}
else {
if(num == 1) {
if(c[0] == c[1]) y++;
else y--;
}
else if(num == n) {
if(c[n - 1] == c[n]) y++;
else y--;
}
else {
if(c[num + 1] == c[num - 1]) {
if(c[num + 1] == c[num]) y += 2;
else y -= 2;
}
}
c[num] = 1 - c[num];
}
cout << x * y << '\n';
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3812kb
input:
3 3 ROW 2 COLUMN 3 ROW 2
output:
3 2 6
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 4672kb
input:
200000 2 ROW 1 ROW 1
output:
39999800000 40000000000
result:
ok 2 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
1 1 COLUMN 1
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
1 100 COLUMN 1 COLUMN 1 ROW 1 ROW 1 COLUMN 1 ROW 1 COLUMN 1 COLUMN 1 ROW 1 ROW 1 COLUMN 1 COLUMN 1 ROW 1 COLUMN 1 COLUMN 1 COLUMN 1 ROW 1 COLUMN 1 ROW 1 COLUMN 1 COLUMN 1 ROW 1 COLUMN 1 COLUMN 1 ROW 1 COLUMN 1 COLUMN 1 ROW 1 COLUMN 1 COLUMN 1 ROW 1 COLUMN 1 COLUMN 1 ROW 1 COLUMN 1 ROW 1 COLUMN 1 COL...
output:
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 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
result:
ok 100 lines
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3476kb
input:
2 100 COLUMN 2 ROW 1 COLUMN 2 COLUMN 2 ROW 2 ROW 1 COLUMN 1 COLUMN 1 COLUMN 1 ROW 1 ROW 1 ROW 1 COLUMN 1 ROW 2 COLUMN 1 COLUMN 2 COLUMN 1 ROW 1 ROW 2 ROW 1 COLUMN 2 ROW 2 ROW 2 COLUMN 2 COLUMN 1 ROW 2 COLUMN 2 ROW 1 ROW 2 ROW 1 ROW 1 COLUMN 2 COLUMN 2 COLUMN 2 COLUMN 2 ROW 2 ROW 1 ROW 1 COLUMN 1 ROW...
output:
2 1 2 1 2 3 0 3 0 0 0 0 2 1 0 -1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 2 1 2 3 0 0 0 3 0 0 2 0 0 3 2 3 4 0 4 5 0 0 0 3 2 0 0 3 0 0 4 0 0 -3 -6 -4 -6 -3 0 0 -2 -4 -2 0
result:
wrong answer 6th lines differ - expected: '1', found: '3'