编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#31657 #2053. 帽子为什么尖尖的? Time Limit Exceeded 75 8199 ms 7296 K C++ 11 / 1.0 K 192022214361 2025-03-16 19:03:48
显示原始代码
#include <iostream>
#include <map>

using namespace std;

int n;
map<long long, int> h;
long long length;
long long p;
long long l, r;

int main() {
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        scanf("%lld", &length);
        h[length]++;
    }

    int q;
    scanf("%d", &q);

    while (q--) {
        int op;
        scanf("%d", &op);

        if (op == 1) {
            scanf("%lld", &p);
            h[p]++;
        } else if (op == 2) {
            scanf("%lld", &p);
            if (h.find(p) != h.end()) {
                h[p]--;
                if (h[p] <= 0) {
                    h.erase(p);
                }
            }
        } else if (op == 3) {
            scanf("%lld %lld", &l, &r);
            long long sum = 0;
            auto st = h.lower_bound(l);

            for (; st != h.end() && st->first <= r; ++st) {
                sum += st->first * st->second;
            }
            printf("%lld\n", sum);
        }
    }

    return 0;
}
子任务 #1
Time Limit Exceeded
得分:75
测试点 #1
Accepted
得分:100
用时:3 ms
内存:328 KiB

输入文件(test0.in

5
1 2 3 4 5
6
1 6 
3 1 5
1 3
3 1 6
2 6
3 1 6

答案文件(test0.out

15
24
18

用户输出

15
24
18

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:3 ms
内存:320 KiB

输入文件(test1.in

5
5 1 5 10 5
7
1 2
1 6
1 6
2 5
2 1
1 1
3 1 1

答案文件(test1.out

1

用户输出

1

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:4 ms
内存:412 KiB

输入文件(test2.in

2
5 5
2
2 5
3 5 6

答案文件(test2.out

5

用户输出

5

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:3 ms
内存:340 KiB

输入文件(test3.in

2
4 4
7
1 1
2 4
2 4
2 1
1 1
2 1
3 1 5

答案文件(test3.out

0

用户输出

0

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:3 ms
内存:312 KiB

输入文件(test4.in

8
7 1 3 1 9 1 7 6
2
1 9
3 1 3

答案文件(test4.out

6

用户输出

6

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:3 ms
内存:324 KiB

输入文件(test5.in

4
5 7 9 1
4
1 8
1 1
2 1
3 1 6

答案文件(test5.out

6

用户输出

6

系统信息

Exited with return code 0
测试点 #7
Accepted
得分:100
用时:3 ms
内存:324 KiB

输入文件(test6.in

2
115259423 28253044
1038
2 115259423
2 28253044
1 307475051
2 307475051
1 164468857
2 16446
<15168 bytes omitted>

答案文件(test6.out

0
0
0
0
0
0
0
0
282170305
0
0
0
532750960
0
0
0
259830191
0
0
0
532966501
0
24
<1041 bytes omitted>

用户输出

0
0
0
0
0
0
0
0
282170305
0
0
0
532750960
0
0
0
259830191
0
0
0
532966501
0
24344213
0
0
0
355632176
0
0
0
0
92107170
0
0
940358
<796 bytes omitted>

系统信息

Exited with return code 0
测试点 #8
Accepted
得分:100
用时:5 ms
内存:412 KiB

输入文件(test7.in

1936
121720261 394635128 416712751 624433516 374594539 55263553 14876291 673696301 168362961 579559
<33031 bytes omitted>

答案文件(test7.out

38488955979
4902851870
224128963441
59302950097
3220318615
345845382705
116690128191
40153461
<2879 bytes omitted>

用户输出

38488955979
4902851870
224128963441
59302950097
3220318615
345845382705
116690128191
401534610437
175011406786
24951864447
92772
<2628 bytes omitted>

系统信息

Exited with return code 0
测试点 #9
Accepted
得分:100
用时:4 ms
内存:324 KiB

输入文件(test8.in

522
399073417 591762126 550588639 814575747 613274311 164008367 191226799 551009320 256459589 25885
<18849 bytes omitted>

答案文件(test8.out

38180877637
31770380714
19965688052
27189403257
13638663549
24493953427
17720900291
306969433
<2513 bytes omitted>

用户输出

38180877637
31770380714
19965688052
27189403257
13638663549
24493953427
17720900291
30696943399
52385656879
133625136028
6031593
<2278 bytes omitted>

系统信息

Exited with return code 0
测试点 #10
Accepted
得分:100
用时:4 ms
内存:328 KiB

输入文件(test9.in

554
133526225 896859685 24003797 339292381 276541237 137642212 92629057 2458345 335197501 79370053 
<31159 bytes omitted>

答案文件(test9.out

114072589044
13693727021
50245542258
21803871076
6304729890
10887377944
72731751776
207850772
<4510 bytes omitted>

用户输出

114072589044
13693727021
50245542258
21803871076
6304729890
10887377944
72731751776
20785077212
46634983775
142849474371
1238708
<4111 bytes omitted>

系统信息

Exited with return code 0
测试点 #11
Accepted
得分:100
用时:3 ms
内存:320 KiB

输入文件(test10.in

38
814483119 395336516 331219657 356069069 65021761 354602593 236429036 747258583 116036251 1485939
<604 bytes omitted>

答案文件(test10.out

1174283405
3428900526
3714456096
421142855
3035163148

用户输出

1174283405
3428900526
3714456096
421142855
3035163148

系统信息

Exited with return code 0
测试点 #12
Time Limit Exceeded
得分:0
用时:2006 ms
内存:3404 KiB

输入文件(test11.in

48162
135422288 321226753 82340641 141819627 546276885 431918731 52269716 242925026 121290427 14443
<2259107 bytes omitted>

答案文件(test11.out

5707342597939
8196901066790
8618661524248
4847553779110
5789337351978
2638600867993
1304841575
<391973 bytes omitted>

用户输出

5707342597939
8196901066790
8618661524248
4847553779110
5789337351978
2638600867993
1304841575972
386991795674
230134626735
2611
<69504 bytes omitted>
测试点 #13
Time Limit Exceeded
得分:0
用时:2053 ms
内存:7296 KiB

输入文件(test12.in

110132
98711952 18771588 104464313 40017 760298345 15968101 40742562 243162271 41807041 11913049 80
<3110071 bytes omitted>

答案文件(test12.out

27909892412904
12782795747100
8052314007188
1553086360891
20439251739839
1217840531261
1318370
<462732 bytes omitted>

用户输出

27909892412904
12782795747100
8052314007188
1553086360891
20439251739839
1217840531261
1318370562952
100386501035
13591868089870
<20352 bytes omitted>
测试点 #14
Accepted
得分:100
用时:46 ms
内存:404 KiB

输入文件(test13.in

1438
841182037 94167954 266760769 297573515 325638721 127872097 687042550 819253621 65774743 931701
<2162775 bytes omitted>

答案文件(test13.out

176284880320
38851829306
10760727510
36933880974
50254246424
15618058636
26578837837
23644934
<180116 bytes omitted>

用户输出

176284880320
38851829306
10760727510
36933880974
50254246424
15618058636
26578837837
236449342091
149697914288
49951775619
73073
<147590 bytes omitted>

系统信息

Exited with return code 0
测试点 #15
Time Limit Exceeded
得分:0
用时:2050 ms
内存:6560 KiB

输入文件(test14.in

98454
382298281 373982896 267712138 200416321 27855981 69938290 680850329 173654113 467811147 34624
<1684079 bytes omitted>

答案文件(test14.out

7338160962500
6316217938350
8964872715714
22127709951049
515902818729
10146308214185
119326116
<167982 bytes omitted>

用户输出

7338160962500
6316217938350
8964872715714
22127709951049
515902818729
10146308214185
11932611677415
5119856185562
29041893760
15
<24448 bytes omitted>
测试点 #16
Time Limit Exceeded
得分:0
用时:2006 ms
内存:5276 KiB

输入文件(test15.in

79343
24566027 355571281 202018431 62222749 76923149 439775425 433400717 272139655 95674806 1590428
<1630249 bytes omitted>

答案文件(test15.out

12061795430409
1383695185040
4489725526915
20554962987170
3957835634395
7271785264787
24675559
<192980 bytes omitted>

用户输出

12061795430409
1383695185040
4489725526915
20554962987170
3957835634395
7271785264787
2467555982107
59593514573
4029376368916
83
<32640 bytes omitted>