QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#545552#7926. Color Inversion on a Huge ChessboardAA_Surely#WA 0ms3804kbC++23726b2024-09-03 14:56:242024-09-03 14:56:25

Judging History

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

  • [2024-09-03 14:56:25]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3804kb
  • [2024-09-03 14:56:24]
  • 提交

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 = 12;

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;
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3548kb

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: 3484kb

input:

200000 2
ROW 1
ROW 1

output:

39999800000
40000000000

result:

ok 2 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

1 1
COLUMN 1

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3804kb

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: 3544kb

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'