QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#545556 | #7926. Color Inversion on a Huge Chessboard | AA_Surely# | WA | 1ms | 3808kb | C++23 | 727b | 2024-09-03 14:57:04 | 2024-09-03 14:57:05 |
Judging History
answer
#include <bits/stdc++.h>
#define FOR(i, x, n) for(int i = x; i < n; i++)
#define F0R(i, n) FOR(i, 0, n)
using namespace std;
typedef long long LL;
const int N = 5e5;
LL n, q;
int up[N], dn[N], rt[N], lf[N];
int main() {
cin >> n >> q;
LL sat = n, sot = n;
while(q--) {
string tp; cin >> tp;
int x; cin >> x; x--;
if (tp[0] == 'R') {
sat += ((x ? (up[x] ? +1 : -1) : 0) + (x < n - 1 ? (dn[x] ? +1 : -1) : 0));
up[x] ^= 1;
dn[x] ^= 1;
}
else {
sot += (x ? (lf[x] ? +1 : -1) : 0) + (x < n - 1 ? (rt[x] ? +1 : -1) : 0);
lf[x] ^= 1;
rt[x] ^= 1;
}
cout << sat * sot << endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3476kb
input:
3 3 ROW 2 COLUMN 3 ROW 2
output:
3 2 6
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
200000 2 ROW 1 ROW 1
output:
39999800000 40000000000
result:
ok 2 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
1 1 COLUMN 1
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3540kb
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: 1ms
memory: 3528kb
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 0 1 0 1 0 0 0 0 0 1 0 1 2 4 2 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 2 1 0 1 2 1 2 0 2 4 2 4 2 4 2 4 2 1 0 1 0 1 2 0 2 1 2 4 2 4 2 1 2 1 0 0 0 1 2 0 2 1 2 4 2 1 2 0 0 0 0 1 2 4 2 1 0 0 0 0 2 4
result:
wrong answer 5th lines differ - expected: '2', found: '0'