QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#664424#7154. InflationTitanicXDzz#14 317ms24172kbC++14630b2024-10-21 20:36:382024-10-21 20:36:38

Judging History

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

  • [2024-10-21 20:36:38]
  • 评测
  • 测评结果:14
  • 用时:317ms
  • 内存:24172kb
  • [2024-10-21 20:36:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
map<long long,int> m;
int main(){
 int n;
 cin>>n;
 long long sumi=0;
 long long su=0;
 for(int i=1;i<=n;i++){
    int x;
    cin>>x;
    m[x]++;
    sumi+=x;
 }
 int q;
 cin>>q;
 for(int i=1;i<=q;i++){
    string s;
    cin>>s;
    if(s[0]=='I'){
        int x;
        cin>>x;
        su+=x;
        sumi+=x*n;
        cout<<sumi<<endl;
    }
    if(s[0]=='S'){
        int x;
        cin>>x;
        int y;
        cin>>y;
        sumi+=(y-x)*m[x-su];
        cout<<sumi<<endl;
        m[y-su]+=m[x-su];
        m[x-su]=0;
    }
 }
 return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 14
Accepted

Test #1:

score: 14
Accepted
time: 1ms
memory: 3580kb

input:

1
23
100
INFLATION 65
INFLATION 37
INFLATION 28
INFLATION 41
INFLATION 53
INFLATION 46
SET 81 22
INFLATION 91
SET 45 85
SET 85 14
INFLATION 58
INFLATION 89
SET 98 60
INFLATION 75
INFLATION 97
SET 91 53
INFLATION 31
INFLATION 51
SET 81 78
SET 16 78
INFLATION 59
SET 10 74
INFLATION 55
SET 7 50
INFLATI...

output:

88
125
153
194
247
293
293
384
384
384
442
531
531
606
703
703
734
785
785
785
844
844
899
899
948
974
1005
1005
1005
1005
1089
1105
1105
1105
1162
1162
1162
1219
1219
1303
1308
1337
1353
1374
1374
1407
1407
1456
1474
1492
1571
1658
1730
1797
1896
1939
1939
2033
2057
2077
2077
2106
2106
2185
2228
23...

result:

ok 100 numbers

Test #2:

score: 14
Accepted
time: 51ms
memory: 4124kb

input:

1
93778
100000
INFLATION 32663
INFLATION 554818
INFLATION 110963
INFLATION 345746
INFLATION 409131
INFLATION 445328
INFLATION 7625
INFLATION 837471
INFLATION 357915
INFLATION 82015
INFLATION 99255
INFLATION 665483
INFLATION 736596
INFLATION 673403
INFLATION 147405
INFLATION 853547
INFLATION 314698
I...

output:

126441
681259
792222
1137968
1547099
1992427
2000052
2837523
3195438
3277453
3376708
4042191
4778787
5452190
5599595
6453142
6767840
6963574
7364083
7594986
8180278
8862838
9464475
9905652
10051918
10642952
11248354
11808260
11920658
12441175
13407678
14069924
14461680
15028874
15322941
16078076
167...

result:

ok 100000 numbers

Test #3:

score: 14
Accepted
time: 35ms
memory: 3572kb

input:

1
119480
100000
INFLATION 87697
INFLATION 153264
INFLATION 499451
INFLATION 506614
INFLATION 190649
INFLATION 837450
INFLATION 218924
INFLATION 757474
INFLATION 228496
INFLATION 429224
INFLATION 933596
INFLATION 756140
INFLATION 680926
INFLATION 927777
INFLATION 223205
INFLATION 85390
INFLATION 4625...

output:

207177
360441
859892
1366506
1557155
2394605
2613529
3371003
3599499
4028723
4962319
5718459
6399385
7327162
7550367
7635757
8098284
8945758
9620063
9720939
10492548
10837252
10954600
11434972
12346508
13251248
13906151
14829003
15036516
15314113
15845720
16807010
17626024
17778075
18117950
18890458...

result:

ok 100000 numbers

Test #4:

score: 14
Accepted
time: 84ms
memory: 8596kb

input:

1
57
100000
INFLATION 3
SET 60 81
SET 60 77
SET 60 3
INFLATION 22
SET 25 10
SET 99 59
SET 59 69
SET 25 54
SET 25 14
SET 69 53
SET 53 47
SET 59 45
SET 47 10
SET 47 53
SET 10 40
SET 40 87
SET 53 79
SET 69 78
SET 53 72
SET 25 79
SET 10 53
SET 53 49
SET 79 70
SET 40 54
SET 45 27
SET 103 9
SET 53 23
SET ...

output:

60
81
81
81
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
9
9
9
57
63
63
63
63
63
63
63
63
63
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
163
163
163
163
163
163
163
...

result:

ok 100000 numbers

Test #5:

score: 14
Accepted
time: 80ms
memory: 3804kb

input:

1
1000000
100000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET...

output:

1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000...

result:

ok 100000 numbers

Subtask #2:

score: 0
Wrong Answer

Test #6:

score: 28
Accepted
time: 1ms
memory: 3464kb

input:

1
23
100
INFLATION 65
INFLATION 37
INFLATION 28
INFLATION 41
INFLATION 53
INFLATION 46
SET 81 22
INFLATION 91
SET 45 85
SET 85 14
INFLATION 58
INFLATION 89
SET 98 60
INFLATION 75
INFLATION 97
SET 91 53
INFLATION 31
INFLATION 51
SET 81 78
SET 16 78
INFLATION 59
SET 10 74
INFLATION 55
SET 7 50
INFLATI...

output:

88
125
153
194
247
293
293
384
384
384
442
531
531
606
703
703
734
785
785
785
844
844
899
899
948
974
1005
1005
1005
1005
1089
1105
1105
1105
1162
1162
1162
1219
1219
1303
1308
1337
1353
1374
1374
1407
1407
1456
1474
1492
1571
1658
1730
1797
1896
1939
1939
2033
2057
2077
2077
2106
2106
2185
2228
23...

result:

ok 100 numbers

Test #7:

score: 28
Accepted
time: 0ms
memory: 3528kb

input:

3
8 7 7
5
SET 8 55
INFLATION 2
INFLATION 1
INFLATION 3
SET 14 7

output:

69
75
78
87
87

result:

ok 5 number(s): "69 75 78 87 87"

Test #8:

score: 28
Accepted
time: 1ms
memory: 3604kb

input:

100
21 89 4 51 46 61 20 85 55 3 85 24 38 36 36 15 68 18 30 96 78 51 24 45 100 91 30 23 6 99 9 29 80 83 47 75 12 92 61 8 12 11 11 35 93 95 97 21 40 31 31 28 66 88 1 5 30 87 20 29 20 12 28 60 42 35 16 84 44 19 67 91 20 86 1 35 19 21 61 45 69 15 19 73 14 97 89 16 13 43 56 98 4 59 67 17 24 85 6 95
100
I...

output:

10620
10644
10644
10594
10547
11947
11974
11464
13964
20564
20564
20564
20564
24064
24064
24064
24064
24064
24064
24064
24064
24064
27464
28464
28464
28464
28464
28464
28464
28464
28464
33164
33164
33164
38964
38964
40364
40364
48064
50664
50664
50664
50664
50664
50664
50664
50664
50664
50764
51564
...

result:

ok 100 numbers

Test #9:

score: 28
Accepted
time: 0ms
memory: 3588kb

input:

100
41 80 1 49 33 12 95 58 38 66 53 26 29 12 49 64 17 30 59 77 63 7 42 30 25 37 64 18 88 9 37 91 91 36 34 10 32 4 26 40 20 93 96 74 42 29 76 71 86 13 21 13 28 2 10 45 60 78 91 80 4 15 23 29 73 26 10 16 71 61 57 72 61 11 16 53 44 38 4 26 55 41 10 46 25 69 18 30 78 22 3 51 17 43 56 81 23 39 23 24
1
SE...

output:

4299

result:

ok 1 number(s): "4299"

Test #10:

score: 28
Accepted
time: 1ms
memory: 3568kb

input:

100
9 4 6 5 1 9 10 7 3 4 8 4 10 10 2 1 5 6 10 10 3 5 5 5 5 7 2 9 8 6 10 5 1 3 7 10 10 8 4 7 8 6 5 9 9 6 4 3 9 3 5 9 2 4 4 5 1 9 5 1 10 9 9 10 2 2 5 2 5 4 3 10 6 10 6 1 8 10 2 10 1 1 10 2 5 4 4 6 7 10 2 6 10 5 3 1 6 6 7 4
100
SET 4 5
SET 9 2
SET 4 5
SET 10 2
SET 5 1
SET 2 5
SET 7 8
SET 9 1
SET 8 5
SE...

output:

586
516
516
380
276
384
390
390
357
302
302
443
765
765
765
114
114
858
858
858
858
858
858
1758
1758
1758
1758
1758
1758
1758
2358
2358
2358
2358
2358
870
870
870
870
1770
1770
1770
1770
1770
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
16...

result:

ok 100 numbers

Test #11:

score: 0
Wrong Answer
time: 1ms
memory: 3572kb

input:

100
29 97 34 65 26 87 23 39 32 33 81 76 10 27 97 51 31 79 30 52 57 15 39 60 41 55 96 41 48 36 51 10 12 66 45 18 58 58 58 70 53 57 47 27 79 87 18 8 86 7 99 43 24 7 66 16 24 68 25 93 45 64 78 60 3 39 69 57 5 55 19 45 29 68 35 11 72 17 21 64 44 60 50 56 67 68 73 60 45 20 10 7 11 90 65 43 49 29 33 39
10...

output:

4534
4579
4654
4668
4701
4761
4887
4911
4831
4756
4835
4975
5042
5042
5042
5026
4864
4865
4865
4849
4849
4785
4785
4770
4716
4700
4784
4820
4809
4953
4842
4842
4833
4989
4942
4900
4905
4923
5047
4985
4985
4745
4769
4747
4499
4499
4499
4499
4346
4362
4362
4506
4506
4506
4484
4484
4445
4325
4223
4448
...

result:

wrong answer 46th numbers differ - expected: '4575', found: '4499'

Subtask #3:

score: 0
Wrong Answer

Test #22:

score: 0
Wrong Answer
time: 231ms
memory: 19672kb

input:

300000
951351 399077 631051 774844 106866 983747 985797 551211 280105 755685 239394 499384 426078 235060 496603 342116 956581 934742 542102 616510 709067 207632 690607 166356 733456 276205 265791 82499 190425 231230 882006 759975 728793 539410 543318 537385 857482 886000 862880 438199 937944 615644 ...

output:

148152403274
147494261738
148456708266
149412918314
149139826474
147790940298
147268566058
148527037738
149749618858
148356708138
148427473546
149309202474
149862350890
149270820682
147128578538
146324423178
144396975370
142899503018
145010667146
143131860202
142053551370
140920879018
141116035594
1...

result:

wrong answer 1st numbers differ - expected: '392965539146', found: '148152403274'

Subtask #4:

score: 0
Wrong Answer

Test #28:

score: 23
Accepted
time: 317ms
memory: 24172kb

input:

300000
947318 850376 902969 604347 67162 326934 983509 617741 797556 532417 364000 987510 494945 673154 690612 243955 959719 909872 189543 627965 826065 586321 119252 290670 655680 527058 254003 559766 354780 659156 812403 214395 771905 87515 353059 677708 142575 286504 122078 61221 239279 348056 55...

output:

149924407594
149924615188
149924944998
149925055079
149925309448
149925635931
149924937354
149926708428
149926581048
149925907778
149925775725
149926373725
149927119925
149927710243
149927711044
149927433676
149926621498
149927345952
149927002016
149926546713
149926126855
149926725608
149925922690
1...

result:

ok 100000 numbers

Test #29:

score: 23
Accepted
time: 182ms
memory: 9464kb

input:

300000
478 672 460 72 104 725 496 48 691 976 56 750 217 185 253 159 309 622 704 500 404 866 217 531 893 689 110 991 823 906 590 275 304 529 742 96 535 153 563 37 975 833 1000 103 370 31 564 494 75 325 241 744 969 409 36 481 755 670 24 771 802 119 417 596 510 415 639 977 522 635 728 64 988 465 607 98...

output:

177285256
203836816
279508258
477933633
715380377
811709087
824157287
1031443405
1117309237
1298472941
1552663841
1752388097
1951598199
2163461499
2315113375
2349293815
2628955278
2840030958
2862597888
3127971546
3407359866
3500116026
3511124858
3618887654
3730267949
3924481821
3811370188
3969513814...

result:

ok 100000 numbers

Test #30:

score: 0
Wrong Answer
time: 191ms
memory: 9532kb

input:

300000
44 88 93 95 2 7 31 70 93 32 16 53 10 88 100 12 83 42 91 68 1 55 39 38 41 42 94 50 63 90 70 91 93 93 56 38 12 70 50 68 33 39 12 32 14 37 29 48 5 23 65 98 20 46 72 23 36 42 52 60 85 52 83 17 15 69 51 83 73 51 49 27 82 51 16 11 38 55 89 9 65 44 68 9 52 29 10 24 80 42 27 62 76 47 70 92 22 2 43 66...

output:

-1420007590
-2937116660
-963460640
-2893972502
-833424353
-65505233
1018538656
1015406426
-361516550
117643810
117643810
2135016162
3234732962
4406111362
6082380082
7285233034
5391556377
7425958393
9335408839
10885690215
10632758400
10632758400
10672310556
12351942498
13939072155
15571487278
1582706...

result:

wrong answer 1st numbers differ - expected: '2874959706', found: '-1420007590'

Subtask #5:

score: 0
Wrong Answer

Test #37:

score: 16
Accepted
time: 0ms
memory: 3496kb

input:

1
23
100
INFLATION 65
INFLATION 37
INFLATION 28
INFLATION 41
INFLATION 53
INFLATION 46
SET 81 22
INFLATION 91
SET 45 85
SET 85 14
INFLATION 58
INFLATION 89
SET 98 60
INFLATION 75
INFLATION 97
SET 91 53
INFLATION 31
INFLATION 51
SET 81 78
SET 16 78
INFLATION 59
SET 10 74
INFLATION 55
SET 7 50
INFLATI...

output:

88
125
153
194
247
293
293
384
384
384
442
531
531
606
703
703
734
785
785
785
844
844
899
899
948
974
1005
1005
1005
1005
1089
1105
1105
1105
1162
1162
1162
1219
1219
1303
1308
1337
1353
1374
1374
1407
1407
1456
1474
1492
1571
1658
1730
1797
1896
1939
1939
2033
2057
2077
2077
2106
2106
2185
2228
23...

result:

ok 100 numbers

Test #38:

score: 16
Accepted
time: 67ms
memory: 4104kb

input:

1
93778
100000
INFLATION 32663
INFLATION 554818
INFLATION 110963
INFLATION 345746
INFLATION 409131
INFLATION 445328
INFLATION 7625
INFLATION 837471
INFLATION 357915
INFLATION 82015
INFLATION 99255
INFLATION 665483
INFLATION 736596
INFLATION 673403
INFLATION 147405
INFLATION 853547
INFLATION 314698
I...

output:

126441
681259
792222
1137968
1547099
1992427
2000052
2837523
3195438
3277453
3376708
4042191
4778787
5452190
5599595
6453142
6767840
6963574
7364083
7594986
8180278
8862838
9464475
9905652
10051918
10642952
11248354
11808260
11920658
12441175
13407678
14069924
14461680
15028874
15322941
16078076
167...

result:

ok 100000 numbers

Test #39:

score: 16
Accepted
time: 63ms
memory: 3756kb

input:

1
119480
100000
INFLATION 87697
INFLATION 153264
INFLATION 499451
INFLATION 506614
INFLATION 190649
INFLATION 837450
INFLATION 218924
INFLATION 757474
INFLATION 228496
INFLATION 429224
INFLATION 933596
INFLATION 756140
INFLATION 680926
INFLATION 927777
INFLATION 223205
INFLATION 85390
INFLATION 4625...

output:

207177
360441
859892
1366506
1557155
2394605
2613529
3371003
3599499
4028723
4962319
5718459
6399385
7327162
7550367
7635757
8098284
8945758
9620063
9720939
10492548
10837252
10954600
11434972
12346508
13251248
13906151
14829003
15036516
15314113
15845720
16807010
17626024
17778075
18117950
18890458...

result:

ok 100000 numbers

Test #40:

score: 16
Accepted
time: 102ms
memory: 8436kb

input:

1
57
100000
INFLATION 3
SET 60 81
SET 60 77
SET 60 3
INFLATION 22
SET 25 10
SET 99 59
SET 59 69
SET 25 54
SET 25 14
SET 69 53
SET 53 47
SET 59 45
SET 47 10
SET 47 53
SET 10 40
SET 40 87
SET 53 79
SET 69 78
SET 53 72
SET 25 79
SET 10 53
SET 53 49
SET 79 70
SET 40 54
SET 45 27
SET 103 9
SET 53 23
SET ...

output:

60
81
81
81
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
103
9
9
9
57
63
63
63
63
63
63
63
63
63
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
163
163
163
163
163
163
163
...

result:

ok 100000 numbers

Test #41:

score: 16
Accepted
time: 96ms
memory: 3600kb

input:

1
1000000
100000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET 1000000 1000000
SET...

output:

1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000...

result:

ok 100000 numbers

Test #42:

score: 16
Accepted
time: 0ms
memory: 3588kb

input:

3
8 7 7
5
SET 8 55
INFLATION 2
INFLATION 1
INFLATION 3
SET 14 7

output:

69
75
78
87
87

result:

ok 5 number(s): "69 75 78 87 87"

Test #43:

score: 16
Accepted
time: 1ms
memory: 3584kb

input:

100
21 89 4 51 46 61 20 85 55 3 85 24 38 36 36 15 68 18 30 96 78 51 24 45 100 91 30 23 6 99 9 29 80 83 47 75 12 92 61 8 12 11 11 35 93 95 97 21 40 31 31 28 66 88 1 5 30 87 20 29 20 12 28 60 42 35 16 84 44 19 67 91 20 86 1 35 19 21 61 45 69 15 19 73 14 97 89 16 13 43 56 98 4 59 67 17 24 85 6 95
100
I...

output:

10620
10644
10644
10594
10547
11947
11974
11464
13964
20564
20564
20564
20564
24064
24064
24064
24064
24064
24064
24064
24064
24064
27464
28464
28464
28464
28464
28464
28464
28464
28464
33164
33164
33164
38964
38964
40364
40364
48064
50664
50664
50664
50664
50664
50664
50664
50664
50664
50764
51564
...

result:

ok 100 numbers

Test #44:

score: 16
Accepted
time: 0ms
memory: 3808kb

input:

100
41 80 1 49 33 12 95 58 38 66 53 26 29 12 49 64 17 30 59 77 63 7 42 30 25 37 64 18 88 9 37 91 91 36 34 10 32 4 26 40 20 93 96 74 42 29 76 71 86 13 21 13 28 2 10 45 60 78 91 80 4 15 23 29 73 26 10 16 71 61 57 72 61 11 16 53 44 38 4 26 55 41 10 46 25 69 18 30 78 22 3 51 17 43 56 81 23 39 23 24
1
SE...

output:

4299

result:

ok 1 number(s): "4299"

Test #45:

score: 16
Accepted
time: 0ms
memory: 3524kb

input:

100
9 4 6 5 1 9 10 7 3 4 8 4 10 10 2 1 5 6 10 10 3 5 5 5 5 7 2 9 8 6 10 5 1 3 7 10 10 8 4 7 8 6 5 9 9 6 4 3 9 3 5 9 2 4 4 5 1 9 5 1 10 9 9 10 2 2 5 2 5 4 3 10 6 10 6 1 8 10 2 10 1 1 10 2 5 4 4 6 7 10 2 6 10 5 3 1 6 6 7 4
100
SET 4 5
SET 9 2
SET 4 5
SET 10 2
SET 5 1
SET 2 5
SET 7 8
SET 9 1
SET 8 5
SE...

output:

586
516
516
380
276
384
390
390
357
302
302
443
765
765
765
114
114
858
858
858
858
858
858
1758
1758
1758
1758
1758
1758
1758
2358
2358
2358
2358
2358
870
870
870
870
1770
1770
1770
1770
1770
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
1644
16...

result:

ok 100 numbers

Test #46:

score: 0
Wrong Answer
time: 0ms
memory: 3600kb

input:

100
29 97 34 65 26 87 23 39 32 33 81 76 10 27 97 51 31 79 30 52 57 15 39 60 41 55 96 41 48 36 51 10 12 66 45 18 58 58 58 70 53 57 47 27 79 87 18 8 86 7 99 43 24 7 66 16 24 68 25 93 45 64 78 60 3 39 69 57 5 55 19 45 29 68 35 11 72 17 21 64 44 60 50 56 67 68 73 60 45 20 10 7 11 90 65 43 49 29 33 39
10...

output:

4534
4579
4654
4668
4701
4761
4887
4911
4831
4756
4835
4975
5042
5042
5042
5026
4864
4865
4865
4849
4849
4785
4785
4770
4716
4700
4784
4820
4809
4953
4842
4842
4833
4989
4942
4900
4905
4923
5047
4985
4985
4745
4769
4747
4499
4499
4499
4499
4346
4362
4362
4506
4506
4506
4484
4484
4445
4325
4223
4448
...

result:

wrong answer 46th numbers differ - expected: '4575', found: '4499'