QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#297422#7926. Color Inversion on a Huge ChessboardSolitaryDream#WA 82ms7068kbC++17988b2024-01-04 13:53:222024-01-04 13:53:22

Judging History

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

  • [2024-01-04 13:53:22]
  • 评测
  • 测评结果:WA
  • 用时:82ms
  • 内存:7068kb
  • [2024-01-04 13:53:22]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> r(n + 1), c(m + 1);
    for (int i = 1; i <= n; ++i) r[i] = i & 1;
    for (int i = 1; i <= m; ++i) c[i] = i & 1;
    r[0] = c[0] = -1;
    int cn = n, cm = n;
    for (int i = 1, x; i <= m; ++i) {
        string opt;
        cin >> opt >> x;
        if (opt[0] == 'R') {
            cn -= (r[x] != r[x - 1]);
            if (x != n) cn -= (r[x + 1] != r[x]);
            r[x] ^= 1;
            cn += (r[x] != r[x - 1]);
            if (x != n) cn += (r[x + 1] != r[x]);
        }  else {
            cm -= (c[x] != c[x - 1]);
            if (x != n) cm -= (c[x + 1] != c[x]);
            c[x] ^= 1;
            cm += (c[x] != c[x - 1]);
            if (x != n) cm += (c[x + 1] != c[x]);
        }
        // cout << cn << ' ' << cm << endl;
        cout << 1ll * cn * cm << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

input:

200000 2
ROW 1
ROW 1

output:

39999800000
40000000000

result:

ok 2 lines

Test #3:

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

input:

1 1
COLUMN 1

output:

1

result:

ok single line: '1'

Test #4:

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

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: 0
Accepted
time: 0ms
memory: 3724kb

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
1
2
1
2
4
2
4
2
1
2
1
2
4
2
4
2
1
2
4
2
1
2
4
2
4
2
1
2
1
2
4
2
4
2
1
2
1
2
1
2
4
2
4
2
4
2
4
2
4
2
1
2
1
2
1
2
4
2
1
2
4
2
4
2
1
2
1
2
4
2
1
2
4
2
1
2
4
2
1
2
4
2
4
2
1
2
4
2
1
2
4
2
4
2
4

result:

ok 100 lines

Test #6:

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

input:

3 100
ROW 1
ROW 1
COLUMN 3
ROW 3
ROW 2
COLUMN 2
ROW 3
COLUMN 3
COLUMN 2
COLUMN 1
ROW 3
ROW 2
ROW 2
COLUMN 3
ROW 3
COLUMN 2
COLUMN 2
ROW 2
COLUMN 3
COLUMN 1
COLUMN 2
COLUMN 2
ROW 1
ROW 1
COLUMN 3
ROW 2
COLUMN 2
COLUMN 3
ROW 3
COLUMN 1
ROW 3
COLUMN 2
COLUMN 1
ROW 3
ROW 3
COLUMN 2
COLUMN 2
COLUMN 1
ROW...

output:

6
9
6
4
4
4
2
1
3
2
4
4
4
2
1
3
1
3
6
9
3
9
6
9
6
2
2
1
2
4
2
2
3
6
3
1
3
2
4
4
2
4
4
6
9
6
4
4
6
9
6
4
2
4
4
4
6
9
6
9
6
3
2
2
6
4
6
9
6
4
2
1
2
3
6
4
2
2
4
4
4
4
4
4
6
4
4
4
2
1
2
3
2
4
2
3
2
4
2
3

result:

ok 100 lines

Test #7:

score: 0
Accepted
time: 49ms
memory: 5160kb

input:

1 500000
COLUMN 1
ROW 1
COLUMN 1
COLUMN 1
ROW 1
COLUMN 1
ROW 1
ROW 1
ROW 1
COLUMN 1
ROW 1
COLUMN 1
ROW 1
COLUMN 1
ROW 1
ROW 1
COLUMN 1
COLUMN 1
ROW 1
ROW 1
COLUMN 1
ROW 1
ROW 1
COLUMN 1
COLUMN 1
COLUMN 1
ROW 1
COLUMN 1
COLUMN 1
ROW 1
ROW 1
ROW 1
ROW 1
ROW 1
COLUMN 1
ROW 1
ROW 1
COLUMN 1
ROW 1
COLUMN...

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
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 500000 lines

Test #8:

score: 0
Accepted
time: 57ms
memory: 5108kb

input:

100 500000
ROW 61
COLUMN 9
COLUMN 12
COLUMN 53
ROW 33
ROW 92
COLUMN 6
COLUMN 60
COLUMN 18
ROW 67
COLUMN 79
ROW 35
ROW 12
ROW 48
ROW 28
ROW 91
ROW 44
COLUMN 11
COLUMN 45
ROW 13
COLUMN 61
ROW 75
COLUMN 15
ROW 75
COLUMN 86
ROW 52
COLUMN 7
ROW 36
COLUMN 13
COLUMN 42
COLUMN 99
ROW 8
COLUMN 8
COLUMN 40
CO...

output:

9800
9604
9408
9212
9024
8836
8648
8460
8272
8096
7912
7740
7568
7396
7224
7224
7052
7052
6888
6888
6888
6720
6560
6724
6560
6400
6400
6400
6400
6240
6080
5928
6084
5928
5772
5928
5772
5616
5460
5304
5148
5016
4884
4884
4752
4680
4680
4550
4410
4284
4158
4032
3904
4026
4026
3894
3762
3762
3876
3876
...

result:

ok 500000 lines

Test #9:

score: 0
Accepted
time: 77ms
memory: 6984kb

input:

500000 500000
COLUMN 402110
COLUMN 19563
COLUMN 9425
COLUMN 365025
ROW 189381
COLUMN 399979
COLUMN 233971
ROW 327398
ROW 222106
COLUMN 435101
COLUMN 345343
COLUMN 424895
ROW 62920
ROW 228188
ROW 90499
ROW 326252
COLUMN 96648
ROW 315146
ROW 62918
COLUMN 116109
ROW 213729
COLUMN 383506
ROW 142029
COLU...

output:

249999000000
249998000000
249997000000
249996000000
249995000016
249994000020
249993000024
249992000048
249991000072
249990000084
249989000096
249988000108
249987000144
249986000180
249985000216
249984000252
249983000280
249982000320
249981000360
249980000396
249979000440
249978000480
249977000528
2...

result:

ok 500000 lines

Test #10:

score: 0
Accepted
time: 73ms
memory: 7016kb

input:

500000 500000
ROW 3666
ROW 19734
ROW 494660
ROW 174051
COLUMN 350072
ROW 306516
COLUMN 120649
ROW 444239
COLUMN 318614
COLUMN 455304
ROW 433831
ROW 344173
ROW 334122
ROW 347475
ROW 44995
ROW 19168
COLUMN 484089
ROW 427892
ROW 329140
ROW 104200
COLUMN 494231
ROW 288323
ROW 183007
ROW 57430
ROW 434219...

output:

249999000000
249998000000
249997000000
249996000000
249995000016
249994000020
249993000040
249992000048
249991000072
249990000096
249989000112
249988000128
249987000144
249986000160
249985000176
249984000192
249983000240
249982000260
249981000280
249980000300
249979000360
249978000384
249977000408
2...

result:

ok 500000 lines

Test #11:

score: 0
Accepted
time: 80ms
memory: 7068kb

input:

500000 500000
COLUMN 17785
ROW 270549
ROW 225472
ROW 168991
COLUMN 185277
COLUMN 458795
ROW 235223
COLUMN 234279
ROW 404851
ROW 144211
COLUMN 416575
COLUMN 369414
ROW 170027
ROW 43313
COLUMN 155095
COLUMN 444999
COLUMN 482631
COLUMN 240889
ROW 361481
COLUMN 401852
COLUMN 120206
ROW 420865
COLUMN 909...

output:

249999000000
249998000004
249997000008
249996000012
249995000024
249994000036
249993000048
249992000064
249991000080
249990000096
249989000120
249988000144
249987000168
249986000192
249985000224
249984000256
249983000288
249982000320
249981000360
249980000396
249979000432
249978000480
249977000520
2...

result:

ok 500000 lines

Test #12:

score: 0
Accepted
time: 68ms
memory: 7020kb

input:

500000 500000
ROW 26
COLUMN 499934
COLUMN 499938
ROW 499995
ROW 499904
COLUMN 96
COLUMN 15
ROW 499927
ROW 499916
COLUMN 499963
ROW 13
COLUMN 499929
COLUMN 93
ROW 59
COLUMN 80
ROW 86
COLUMN 499964
COLUMN 499922
ROW 1
COLUMN 13
ROW 499967
COLUMN 499914
ROW 499937
ROW 67
ROW 499972
COLUMN 499957
COLUMN...

output:

249999000000
249998000004
249997000008
249996000016
249995000024
249994000036
249993000048
249992000064
249991000080
249990000100
249989000120
249988000144
249987000168
249986000196
249985000224
249984000256
249984000256
249983000288
249982500306
249981500340
249980500380
249979500418
249978500462
2...

result:

ok 500000 lines

Test #13:

score: 0
Accepted
time: 82ms
memory: 6988kb

input:

500000 499999
COLUMN 361956
ROW 145517
ROW 15281
ROW 388636
ROW 152103
COLUMN 402893
COLUMN 80639
COLUMN 139320
COLUMN 27667
COLUMN 82556
COLUMN 63716
COLUMN 113529
ROW 301173
COLUMN 301174
ROW 345006
COLUMN 73724
COLUMN 467291
COLUMN 265401
ROW 190250
COLUMN 247710
ROW 215696
ROW 108449
ROW 17317
C...

output:

249999000000
249998000004
249997000008
249996000012
249995000016
249994000032
249993000048
249992000064
249991000080
249990000096
249989000112
249988000128
249987000160
249986000180
249985000216
249984000240
249983000264
249982000288
249981000336
249980000364
249979000416
249978000468
249977000520
2...

result:

ok 499999 lines

Test #14:

score: -100
Wrong Answer
time: 79ms
memory: 6976kb

input:

499999 499998
ROW 37459
ROW 171749
ROW 208323
COLUMN 199541
ROW 370190
COLUMN 197644
COLUMN 137395
COLUMN 374294
ROW 226434
ROW 117992
ROW 36952
COLUMN 441379
ROW 387901
ROW 34836
ROW 292806
COLUMN 6341
COLUMN 319407
ROW 39510
ROW 453907
ROW 188006
COLUMN 303966
COLUMN 418344
ROW 68254
ROW 211294
RO...

output:

249998000003
249997000005
249996000007
249995000021
249994000027
249993000045
249992000063
249991000081
249990000099
249989000117
249988000135
249987000165
249986000187
249985000209
249984000231
249983000273
249982000315
249981000345
249980000375
249979000405
249978000459
249977000513
249976000551
2...

result:

wrong answer 46838th lines differ - expected: '209090329596', found: '209091244504'