QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#703902 | #103. Money | TheZone | 100 ✓ | 619ms | 54608kb | C++20 | 675b | 2024-11-02 18:50:09 | 2024-11-02 18:50:30 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int N = 1e6 + 10;
int n, a[N];
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for(int i = 1; i <= n; i ++)
cin >> a[i];
set<int> s;
s.insert(N);
int ans = 1;
for(int i = 2, l = 1, ub = N; i <= n; i ++) {
if(a[i] < a[i - 1] || a[i] > ub) {
while(l < i) {
s.insert(a[l]);
l ++;
}
ub = *s.upper_bound(a[i]);
ans ++;
}
}
cout << ans << "\n";
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 9
Accepted
Test #1:
score: 9
Accepted
time: 0ms
memory: 3592kb
input:
6 3 6 4 5 1 2
output:
3
result:
ok single line: '3'
Test #2:
score: 9
Accepted
time: 0ms
memory: 3816kb
input:
6 1 3 5 2 4 6
output:
4
result:
ok single line: '4'
Test #3:
score: 9
Accepted
time: 0ms
memory: 3596kb
input:
6 2 4 6 1 3 5
output:
4
result:
ok single line: '4'
Test #4:
score: 9
Accepted
time: 0ms
memory: 3484kb
input:
6 2 3 2 3 2 3
output:
3
result:
ok single line: '3'
Test #5:
score: 9
Accepted
time: 0ms
memory: 3620kb
input:
6 1 2 5 6 3 4
output:
2
result:
ok single line: '2'
Test #6:
score: 9
Accepted
time: 0ms
memory: 3604kb
input:
6 1 2 5 3 4 6
output:
3
result:
ok single line: '3'
Test #7:
score: 9
Accepted
time: 0ms
memory: 3616kb
input:
4 550483 550483 745079 243195
output:
2
result:
ok single line: '2'
Test #8:
score: 9
Accepted
time: 0ms
memory: 3780kb
input:
8 718639 990890 718639 990890 990890 990890 718639 718639
output:
3
result:
ok single line: '3'
Test #9:
score: 9
Accepted
time: 0ms
memory: 3600kb
input:
6 75094 75094 75094 576383 162362 23156
output:
3
result:
ok single line: '3'
Test #10:
score: 9
Accepted
time: 0ms
memory: 3592kb
input:
8 577594 541467 472059 277648 577594 541467 472059 472059
output:
7
result:
ok single line: '7'
Test #11:
score: 9
Accepted
time: 0ms
memory: 3548kb
input:
8 831697 182542 182542 246377 246377 19290 182542 19290
output:
4
result:
ok single line: '4'
Test #12:
score: 9
Accepted
time: 0ms
memory: 3588kb
input:
8 710010 388188 309143 388188 710010 388188 710010 484815
output:
6
result:
ok single line: '6'
Test #13:
score: 9
Accepted
time: 0ms
memory: 3532kb
input:
8 806776 806776 223756 806776 806776 806776 806776 806776
output:
2
result:
ok single line: '2'
Test #14:
score: 9
Accepted
time: 0ms
memory: 3588kb
input:
8 32911 32911 32911 32911 562837 521201 562837 32911
output:
3
result:
ok single line: '3'
Test #15:
score: 9
Accepted
time: 0ms
memory: 3540kb
input:
8 997465 997465 968321 968321 395262 438383 308806 603887
output:
5
result:
ok single line: '5'
Test #16:
score: 9
Accepted
time: 0ms
memory: 3764kb
input:
8 468346 200735 468346 200735 887353 250519 181007 825687
output:
7
result:
ok single line: '7'
Subtask #2:
score: 16
Accepted
Dependency #1:
100%
Accepted
Test #17:
score: 16
Accepted
time: 0ms
memory: 3616kb
input:
15 179920 568853 179920 568853 849301 849301 568853 956508 849301 614244 179920 568853 179920 179920 614244
output:
10
result:
ok single line: '10'
Test #18:
score: 16
Accepted
time: 0ms
memory: 3600kb
input:
14 626116 805032 60415 626116 38887 526454 60415 38887 89526 805032 526454 38887 89526 38887
output:
12
result:
ok single line: '12'
Test #19:
score: 16
Accepted
time: 0ms
memory: 3780kb
input:
10 494573 746756 237932 746756 814455 814455 91396 494573 237932 814455
output:
7
result:
ok single line: '7'
Test #20:
score: 16
Accepted
time: 0ms
memory: 3784kb
input:
20 371839 10893 10893 10893 987087 371839 10893 987087 10893 371839 371839 844905 844905 10893 844905 844905 987087 987087 987087 371839
output:
11
result:
ok single line: '11'
Test #21:
score: 16
Accepted
time: 0ms
memory: 3588kb
input:
20 197220 303712 197220 389265 672397 303712 303712 403944 403944 672397 197220 303712 389265 672397 672397 629613 303712 672397 197220 389265
output:
13
result:
ok single line: '13'
Test #22:
score: 16
Accepted
time: 0ms
memory: 3616kb
input:
20 509271 509271 922019 509271 922019 922019 509271 509271 922019 509271 509271 922019 509271 509271 922019 922019 509271 922019 922019 922019
output:
6
result:
ok single line: '6'
Test #23:
score: 16
Accepted
time: 0ms
memory: 3596kb
input:
20 757151 645451 757151 757151 757151 645451 757151 645451 757151 813992 813992 813992 757151 813992 813992 813992 757151 813992 757151 813992
output:
8
result:
ok single line: '8'
Test #24:
score: 16
Accepted
time: 0ms
memory: 3516kb
input:
20 746146 385991 385991 350689 385991 385991 746146 385991 746146 746146 385991 350689 350689 746146 746146 350689 350689 385991 746146 385991
output:
11
result:
ok single line: '11'
Test #25:
score: 16
Accepted
time: 0ms
memory: 3592kb
input:
20 440622 720564 700447 459690 720564 440622 440622 459690 440622 459690 394328 352065 812964 451269 807580 354743 314770 652281 856740 260532
output:
16
result:
ok single line: '16'
Test #26:
score: 16
Accepted
time: 0ms
memory: 3532kb
input:
20 324662 468027 324662 324662 468027 324662 468027 324662 324662 468027 963343 944165 165047 127072 405908 918630 854332 571550 909067 448963
output:
14
result:
ok single line: '14'
Subtask #3:
score: 20
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #27:
score: 20
Accepted
time: 0ms
memory: 3612kb
input:
200 165 2 175 136 128 88 33 189 148 4 61 95 158 143 198 64 41 45 37 73 62 72 70 24 191 20 104 28 99 141 200 176 91 7 43 199 82 180 39 12 92 19 170 196 35 46 17 145 49 117 173 63 53 123 87 182 83 171 59 108 185 3 142 153 102 81 186 68 194 197 71 140 118 74 188 76 85 75 52 103 150 98 31 114 193 78 125...
output:
196
result:
ok single line: '196'
Test #28:
score: 20
Accepted
time: 0ms
memory: 3792kb
input:
81 37 2 58 16 18 65 8 81 21 71 33 12 72 41 36 28 54 25 49 22 13 80 7 77 29 26 53 27 17 11 59 32 30 66 76 64 44 14 69 10 4 42 35 78 3 46 73 48 67 50 60 34 20 79 55 56 57 45 24 9 31 47 43 40 38 62 1 51 63 70 68 5 19 74 75 15 52 6 61 39 23
output:
77
result:
ok single line: '77'
Test #29:
score: 20
Accepted
time: 0ms
memory: 3552kb
input:
84 61 43 21 4 3 45 9 72 55 50 41 59 42 62 15 16 57 71 51 1 37 73 7 14 8 63 27 29 39 67 47 80 69 12 35 79 38 19 2 28 64 30 13 44 40 23 53 60 49 31 56 52 77 54 76 6 83 70 46 48 84 32 26 20 65 66 11 68 33 78 25 34 22 74 75 17 58 10 24 5 81 18 36 82
output:
80
result:
ok single line: '80'
Test #30:
score: 20
Accepted
time: 0ms
memory: 3540kb
input:
81 1 20 53 35 10 3 74 48 22 38 26 12 5 66 15 16 49 44 7 60 73 75 68 81 25 51 57 28 21 46 65 67 33 11 14 58 76 77 18 32 54 42 34 30 6 52 62 8 39 80 47 61 40 70 19 56 55 64 59 17 31 2 79 43 41 9 72 69 29 27 36 71 63 45 13 4 23 78 37 50 24
output:
77
result:
ok single line: '77'
Test #31:
score: 20
Accepted
time: 0ms
memory: 3616kb
input:
118 43 2 28 111 5 26 3 23 76 10 11 12 36 57 15 33 31 109 30 20 116 81 59 1 34 89 29 103 86 14 107 4 67 110 79 50 54 45 21 74 40 93 62 44 61 115 48 56 49 18 97 53 64 96 52 83 63 7 112 71 77 100 98 8 65 95 35 68 27 70 101 41 73 60 85 75 55 78 72 38 25 82 69 13 51 6 87 117 118 46 106 108 94 91 39 17 99...
output:
110
result:
ok single line: '110'
Test #32:
score: 20
Accepted
time: 0ms
memory: 3604kb
input:
300 145507 564378 903068 564378 471956 145507 903068 564378 471956 565860 564378 903068 385551 565860 564378 903068 903068 385551 385551 385551 564378 471956 564378 145507 565860 471956 471956 564378 385551 471956 471956 385551 385551 145507 471956 564378 385551 471956 385551 903068 471956 145507 90...
output:
214
result:
ok single line: '214'
Test #33:
score: 20
Accepted
time: 0ms
memory: 3532kb
input:
300 198887 496454 496454 176658 198887 672013 176658 496454 496454 198887 176658 176658 496454 672013 176658 176658 496454 672013 176658 198887 672013 496454 176658 496454 672013 496454 672013 496454 496454 496454 176658 496454 198887 198887 496454 176658 672013 496454 496454 176658 672013 672013 17...
output:
180
result:
ok single line: '180'
Test #34:
score: 20
Accepted
time: 0ms
memory: 3548kb
input:
300 97004 968456 968456 968456 136315 623985 63638 63638 671117 671117 671117 623985 97004 63638 63638 97004 968456 968456 968456 623985 623985 136315 968456 419157 136315 968456 63638 419157 623985 97004 623985 419157 136315 97004 623985 63638 419157 968456 968456 671117 968456 63638 623985 968456 ...
output:
217
result:
ok single line: '217'
Test #35:
score: 20
Accepted
time: 0ms
memory: 3828kb
input:
300 376675 480811 480811 480811 480811 376675 480811 376675 480811 480811 480811 376675 480811 376675 480811 376675 376675 376675 480811 480811 480811 376675 480811 376675 480811 376675 376675 376675 376675 480811 480811 480811 480811 480811 480811 376675 376675 480811 480811 376675 480811 480811 37...
output:
78
result:
ok single line: '78'
Test #36:
score: 20
Accepted
time: 0ms
memory: 3480kb
input:
300 581370 581370 716169 581370 812365 716169 716169 812365 581370 581370 812365 43399 581370 43399 43399 43399 43399 43399 581370 43399 581370 581370 43399 43399 812365 43399 812365 581370 581370 581370 716169 812365 43399 716169 812365 581370 581370 43399 812365 716169 581370 716169 581370 43399 8...
output:
179
result:
ok single line: '179'
Test #37:
score: 20
Accepted
time: 0ms
memory: 3624kb
input:
300 531046 550600 550600 401018 401018 7056 550600 200634 550600 758009 200634 200634 531046 401018 531046 550600 200634 200634 200634 550600 7056 7056 401018 758009 550600 200634 7056 550600 758009 550600 758009 401018 401018 758009 550600 758009 200634 7056 401018 401018 758009 531046 758009 20063...
output:
258
result:
ok single line: '258'
Test #38:
score: 20
Accepted
time: 0ms
memory: 3532kb
input:
300 739447 739447 571323 571323 571323 571323 739447 739447 163207 739447 571323 571323 571323 163207 163207 571323 739447 163207 163207 163207 163207 571323 163207 571323 163207 163207 163207 739447 163207 163207 739447 163207 571323 739447 739447 571323 571323 739447 163207 571323 571323 163207 57...
output:
221
result:
ok single line: '221'
Subtask #4:
score: 55
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #39:
score: 55
Accepted
time: 32ms
memory: 5992kb
input:
480481 806002 806002 621477 91785 91785 776054 806002 833638 806002 776054 776054 621477 833638 621477 806002 833638 91785 621477 776054 833638 621477 806002 776054 91785 833638 91785 621477 621477 776054 806002 91785 833638 776054 621477 833638 806002 91785 776054 621477 776054 91785 91785 621477 9...
output:
320287
result:
ok single line: '320287'
Test #40:
score: 55
Accepted
time: 56ms
memory: 7000kb
input:
788953 897530 211298 189842 844784 897530 652770 897530 189842 869645 652770 292378 844784 809241 206487 809241 652770 75077 652770 292378 844784 809241 206487 897530 809241 75077 211298 844784 897530 897530 75077 869645 211298 652770 869645 292378 75077 75077 809241 844784 292378 189842 809241 1898...
output:
658146
result:
ok single line: '658146'
Test #41:
score: 55
Accepted
time: 21ms
memory: 6928kb
input:
388796 806119 739351 66427 113886 113886 113886 66427 113886 113886 113886 66427 113886 739351 113886 806119 739351 113886 66427 113886 66427 113886 66427 739351 113886 806119 66427 66427 806119 66427 66427 806119 113886 113886 806119 806119 113886 739351 66427 113886 113886 739351 113886 806119 739...
output:
232110
result:
ok single line: '232110'
Test #42:
score: 55
Accepted
time: 25ms
memory: 4964kb
input:
343838 199431 288483 635849 288483 682538 288483 887335 199431 768533 474490 682538 22543 828427 199431 288483 22543 682538 733193 948920 887335 828427 618430 828427 828427 618430 618430 474490 733193 682538 288483 887335 474490 247254 474490 22543 828427 948920 618430 948920 768533 733193 682538 68...
output:
297964
result:
ok single line: '297964'
Test #43:
score: 55
Accepted
time: 18ms
memory: 5920kb
input:
242351 818489 249811 887102 290660 887102 655949 673218 692765 887102 655949 827261 887102 827261 624710 624710 673218 290660 887102 818489 290660 827261 448600 900855 827261 448600 731251 109255 448600 448600 274329 274329 624710 818489 827261 655949 448600 448600 624710 655949 249811 274329 109255...
output:
211988
result:
ok single line: '211988'
Test #44:
score: 55
Accepted
time: 65ms
memory: 7496kb
input:
1000000 738237 738237 893082 490298 43009 277665 823270 490298 738237 738237 490298 815666 490298 490298 490298 738237 277665 43009 893082 277665 490298 490298 823270 738237 490298 43009 277665 815666 823270 277665 738237 490298 277665 477234 277665 43009 43009 738237 490298 477234 490298 43009 4902...
output:
777569
result:
ok single line: '777569'
Test #45:
score: 55
Accepted
time: 59ms
memory: 7500kb
input:
1000000 74304 74304 74304 325602 712628 325602 339267 325602 712628 325602 774887 339267 339267 74304 882663 774887 712628 882663 712628 712628 774887 339267 325602 712628 325602 325602 339267 74304 325602 774887 712628 882663 74304 74304 712628 774887 882663 339267 774887 774887 339267 882663 88266...
output:
714524
result:
ok single line: '714524'
Test #46:
score: 55
Accepted
time: 67ms
memory: 7520kb
input:
1000000 254366 875788 564327 564327 438301 564327 370909 438301 370909 438301 254366 131010 875788 545794 131010 962129 370909 962129 254366 254366 875788 370909 131010 254366 875788 370909 962129 564327 962129 370909 962129 131010 131010 370909 370909 370909 875788 254366 254366 254366 254366 37090...
output:
777558
result:
ok single line: '777558'
Test #47:
score: 55
Accepted
time: 54ms
memory: 7724kb
input:
1000000 937517 114387 114387 114387 937517 937517 114387 937517 937517 937517 937517 937517 114387 114387 114387 114387 937517 114387 937517 937517 937517 114387 114387 114387 114387 114387 114387 114387 937517 114387 937517 937517 937517 937517 114387 937517 937517 937517 114387 114387 114387 11438...
output:
249890
result:
ok single line: '249890'
Test #48:
score: 55
Accepted
time: 55ms
memory: 7436kb
input:
1000000 814027 682934 214670 214670 814027 214670 814027 214670 682934 814027 214670 214670 682934 814027 214670 682934 682934 814027 814027 682934 814027 214670 214670 814027 814027 682934 214670 814027 682934 214670 214670 214670 814027 214670 214670 814027 682934 214670 814027 214670 814027 21467...
output:
500240
result:
ok single line: '500240'
Test #49:
score: 55
Accepted
time: 247ms
memory: 25884kb
input:
1000000 717896 297551 254872 297551 619474 717896 717896 717896 297551 717896 619474 297551 717896 342604 619474 297551 297551 342604 717896 254872 619474 297551 619474 619474 342604 297551 619474 342604 717896 297551 297551 297551 619474 254872 717896 254872 717896 297551 297551 717896 297551 34260...
output:
833179
result:
ok single line: '833179'
Test #50:
score: 55
Accepted
time: 245ms
memory: 25972kb
input:
1000000 563974 664553 563974 609181 563974 664553 664553 609181 664553 609181 664553 664553 609181 563974 563974 664553 609181 664553 664553 609181 609181 664553 609181 664553 563974 563974 563974 609181 563974 609181 664553 609181 664553 563974 609181 664553 664553 609181 609181 609181 664553 60918...
output:
750197
result:
ok single line: '750197'
Test #51:
score: 55
Accepted
time: 237ms
memory: 25992kb
input:
1000000 173690 978648 978648 978648 90726 887297 173690 90726 488610 488610 504332 978648 504332 978648 504332 504332 488610 236309 978648 488610 887297 887297 488610 504332 887297 173690 887297 887297 504332 887297 978648 236309 504332 504332 504332 887297 488610 504332 504332 978648 488610 504332 ...
output:
874390
result:
ok single line: '874390'
Test #52:
score: 55
Accepted
time: 242ms
memory: 25976kb
input:
1000000 785890 785890 785890 785890 785890 257394 895111 895111 785890 785890 895111 257394 895111 785890 895111 257394 895111 785890 257394 785890 785890 257394 895111 257394 785890 257394 785890 785890 257394 895111 895111 257394 895111 895111 895111 257394 895111 257394 257394 257394 785890 25739...
output:
750316
result:
ok single line: '750316'
Test #53:
score: 55
Accepted
time: 239ms
memory: 25944kb
input:
1000000 119439 119439 119439 354111 733573 119439 354111 119439 354111 666014 354111 733573 733573 666014 354111 666014 733573 354111 666014 119439 733573 666014 354111 733573 666014 354111 666014 119439 119439 354111 666014 119439 354111 119439 119439 666014 119439 733573 733573 666014 119439 66601...
output:
798579
result:
ok single line: '798579'
Test #54:
score: 55
Accepted
time: 253ms
memory: 26116kb
input:
1000000 749078 95090 749078 276834 95090 95090 749078 95090 276834 276834 95090 276834 95090 276834 749078 95090 749078 95090 749078 95090 95090 749078 95090 95090 749078 276834 276834 95090 95090 276834 95090 95090 95090 749078 749078 276834 749078 276834 276834 95090 749078 95090 276834 276834 276...
output:
750593
result:
ok single line: '750593'
Test #55:
score: 55
Accepted
time: 610ms
memory: 54608kb
input:
1000000 137937 689287 749751 213838 323292 220145 27367 496112 9 253229 494241 100662 832524 241217 849605 539880 454382 913160 674827 553987 813309 121909 473805 24 508288 15150 170857 212212 392697 603495 583969 462696 902613 916846 433809 746195 806984 915612 768145 40 41 704625 208383 375798 640...
output:
981871
result:
ok single line: '981871'
Test #56:
score: 55
Accepted
time: 583ms
memory: 54608kb
input:
1000000 473653 274191 673488 575890 732597 6 817684 112394 240635 10 705580 498254 673721 136310 777252 336551 17 209477 792403 286071 597553 22 68662 73521 650882 70503 27 814565 84638 576421 672317 262127 992620 843727 946199 17915 299707 428047 77775 572014 353116 631269 43 717131 45 462929 64430...
output:
981543
result:
ok single line: '981543'
Test #57:
score: 55
Accepted
time: 619ms
memory: 54388kb
input:
1000000 913583 648901 29748 168104 439654 531375 940907 975796 916274 573614 315672 902487 875695 65939 179546 16 932273 270863 592724 20 903148 627706 750924 24 575312 832882 948443 99414 641626 571316 436300 32 33 315884 38887 938286 755622 798718 143626 612247 80616 72125 571405 44 10085 946585 4...
output:
981717
result:
ok single line: '981717'
Test #58:
score: 55
Accepted
time: 550ms
memory: 54368kb
input:
1000000 890981 682430 885587 406305 608819 6 13440 8 169839 299077 987867 667064 117225 14 15 871074 692394 757985 167079 20 567791 894368 314302 267516 534225 519281 411944 658033 29 422224 95896 248433 33 872721 347648 418051 363067 645883 748225 64060 41 32221 440223 969249 297037 128967 496777 5...
output:
981788
result:
ok single line: '981788'
Test #59:
score: 55
Accepted
time: 563ms
memory: 54372kb
input:
1000000 1 2 247847 4 767575 281751 982126 200687 595447 224116 11 582233 170441 536856 15 813278 17 193175 533118 270380 731300 137720 37325 305382 645611 222156 27 330863 429758 145089 964866 772688 988043 696311 35 705598 398126 107440 514209 310301 695064 42 897071 420645 322317 413795 552607 375...
output:
981660
result:
ok single line: '981660'
Test #60:
score: 55
Accepted
time: 573ms
memory: 54304kb
input:
1000000 285138 720188 820135 821835 912313 445598 698124 93626 684168 80897 472041 12 683196 581094 940218 418301 625806 251460 74592 341354 147567 488020 905738 517922 499094 26 685656 28 985043 963054 706514 26889 10376 200909 35 924574 206361 38 49028 715521 749146 42 43 796788 282853 695776 6895...
output:
982003
result:
ok single line: '982003'
Test #61:
score: 55
Accepted
time: 572ms
memory: 54308kb
input:
1000000 421947 680547 224842 941720 264782 928834 919613 655115 329291 216555 740950 68546 13 14 424054 269349 430233 57027 620407 622067 132064 160170 23 957178 954378 282799 828523 28 29 815004 657103 24882 697740 214907 300370 18106 234135 498496 752368 792962 814476 775026 597712 272942 987753 4...
output:
981663
result:
ok single line: '981663'
Test #62:
score: 55
Accepted
time: 563ms
memory: 54264kb
input:
1000000 963500 2 664028 4 692637 802848 520377 690056 852992 699838 161627 12 307234 14 724375 16 374888 341299 198761 265460 21 39860 23 644401 995855 155645 471022 351848 966423 30 31 481102 742577 574621 35 933115 142392 38 404774 13842 294373 358564 883132 44 891923 169413 767123 898379 420388 5...
output:
981624
result:
ok single line: '981624'