Submission ID Problem Status Score Time Memory Code / Answer files User Submit time
#18163 #57. 每日任務 Daily Mission Accepted 100 810 ms 2140 K C++ 17 / 533 B HKSCF2023-022 2023-07-15 15:13:44
Show orginal code
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#define ll long long

using namespace std;

vector<ll> V;
ll n, cnt = 0, A[200000], dp[200000];
int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    sort(A, A + n);
    for (int i = 0; i < n; ++i) {
        if (A[i] > cnt + 1) {
            cout << cnt + 1 << endl;
            return 0;
        }
        cnt += A[i];
    }
    cout << cnt + 1 << '\n';
}
Subtask #1
Accepted
Score: 15
Test case #1
Accepted
Score: 100
Time: 12 ms
Memory: 452 KiB

Input file

3
1 2 4

Output file

8

Your output

8

System message

Exited with return code 0
Test case #2
Accepted
Score: 100
Time: 12 ms
Memory: 420 KiB

Input file

6
2 1 1 2 6 23

Output file

13

Your output

13

System message

Exited with return code 0
Test case #3
Accepted
Score: 100
Time: 13 ms
Memory: 416 KiB

Input file

4
3 1 1 775

Output file

6

Your output

6

System message

Exited with return code 0
Test case #4
Accepted
Score: 100
Time: 12 ms
Memory: 476 KiB

Input file

6
151 2 4 444 755 1

Output file

8

Your output

8

System message

Exited with return code 0
Test case #5
Accepted
Score: 100
Time: 13 ms
Memory: 332 KiB

Input file

10
9 2 12 1740 12 4 1 1 1 5

Output file

48

Your output

48

System message

Exited with return code 0
Test case #6
Accepted
Score: 100
Time: 12 ms
Memory: 436 KiB

Input file

16
90 97 11 218 110 21 38 27 15 1 63 87 50 320 76 257

Output file

2

Your output

2

System message

Exited with return code 0
Test case #7
Accepted
Score: 100
Time: 13 ms
Memory: 440 KiB

Input file

17
1 23 36 121 117 282 247 3 96 136 3 141 21 2 2 34 24

Output file

12

Your output

12

System message

Exited with return code 0
Test case #8
Accepted
Score: 100
Time: 14 ms
Memory: 476 KiB

Input file

20
5 30 2 13 2 68 1 32 2 9 34 6 15 21 8 14 2 16 10 6

Output file

297

Your output

297

System message

Exited with return code 0
Test case #9
Accepted
Score: 100
Time: 16 ms
Memory: 432 KiB

Input file

10
1 2 4 8 16 32 64 128 256 512

Output file

1024

Your output

1024

System message

Exited with return code 0
Subtask #2
Accepted
Score: 20
Test case #1
Accepted
Score: 100
Time: 12 ms
Memory: 452 KiB

Input file

3
1 2 4

Output file

8

Your output

8

System message

Exited with return code 0
Test case #2
Accepted
Score: 100
Time: 12 ms
Memory: 420 KiB

Input file

6
2 1 1 2 6 23

Output file

13

Your output

13

System message

Exited with return code 0
Test case #3
Accepted
Score: 100
Time: 13 ms
Memory: 416 KiB

Input file

4
3 1 1 775

Output file

6

Your output

6

System message

Exited with return code 0
Test case #4
Accepted
Score: 100
Time: 12 ms
Memory: 476 KiB

Input file

6
151 2 4 444 755 1

Output file

8

Your output

8

System message

Exited with return code 0
Test case #5
Accepted
Score: 100
Time: 13 ms
Memory: 332 KiB

Input file

10
9 2 12 1740 12 4 1 1 1 5

Output file

48

Your output

48

System message

Exited with return code 0
Test case #6
Accepted
Score: 100
Time: 12 ms
Memory: 436 KiB

Input file

16
90 97 11 218 110 21 38 27 15 1 63 87 50 320 76 257

Output file

2

Your output

2

System message

Exited with return code 0
Test case #7
Accepted
Score: 100
Time: 13 ms
Memory: 440 KiB

Input file

17
1 23 36 121 117 282 247 3 96 136 3 141 21 2 2 34 24

Output file

12

Your output

12

System message

Exited with return code 0
Test case #8
Accepted
Score: 100
Time: 14 ms
Memory: 476 KiB

Input file

20
5 30 2 13 2 68 1 32 2 9 34 6 15 21 8 14 2 16 10 6

Output file

297

Your output

297

System message

Exited with return code 0
Test case #9
Accepted
Score: 100
Time: 5 ms
Memory: 252 KiB

Input file

26
35 459 86 1 77 20 52 133 226 2 12 98 1 97 26 18 30 180 10 26 58 24 3 2 13 73

Output file

1763

Your output

1763

System message

Exited with return code 0
Test case #10
Accepted
Score: 100
Time: 7 ms
Memory: 252 KiB

Input file

31
11 42 1 33 14 6 8 123 16 1 29 25 1 17 88 44 43 61 31 38 21 18 30 28 4 60 25 7 5 20 2

Output file

853

Your output

853

System message

Exited with return code 0
Test case #11
Accepted
Score: 100
Time: 3 ms
Memory: 364 KiB

Input file

94
10 49 14 12 27 23 25 23 17 13 19 1 6 8 2 18 17 23 23 14 11 14 1 1 10 2 12 2 9 17 4 3 51 52 15 23 
<149 bytes omitted>

Output file

1530

Your output

1530

System message

Exited with return code 0
Test case #12
Accepted
Score: 100
Time: 7 ms
Memory: 368 KiB

Input file

493
3 5 1 1 8 2 1 6 1 3 2 1 6 3 4 1 2 5 3 2 2 3 7 1 4 2 11 2 7 3 4 2 4 2 2 2 5 2 5 3 6 1 1 2 5 3 3 1
<928 bytes omitted>

Output file

1978

Your output

1978

System message

Exited with return code 0
Test case #13
Accepted
Score: 100
Time: 9 ms
Memory: 376 KiB

Input file

877
1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 
<1658 bytes omitted>

Output file

953

Your output

953

System message

Exited with return code 0
Test case #14
Accepted
Score: 100
Time: 4 ms
Memory: 372 KiB

Input file

1922
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1
<3749 bytes omitted>

Output file

2001

Your output

2001

System message

Exited with return code 0
Test case #15
Accepted
Score: 100
Time: 7 ms
Memory: 380 KiB

Input file

2000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
<3905 bytes omitted>

Output file

2001

Your output

2001

System message

Exited with return code 0
Test case #16
Accepted
Score: 100
Time: 16 ms
Memory: 432 KiB

Input file

10
1 2 4 8 16 32 64 128 256 512

Output file

1024

Your output

1024

System message

Exited with return code 0
Subtask #3
Accepted
Score: 20
Test case #1
Accepted
Score: 100
Time: 12 ms
Memory: 452 KiB

Input file

3
1 2 4

Output file

8

Your output

8

System message

Exited with return code 0
Test case #2
Accepted
Score: 100
Time: 16 ms
Memory: 432 KiB

Input file

10
1 2 4 8 16 32 64 128 256 512

Output file

1024

Your output

1024

System message

Exited with return code 0
Test case #3
Accepted
Score: 100
Time: 5 ms
Memory: 368 KiB

Input file

11
1 2 4 8 16 32 64 128 256 512 1024

Output file

2048

Your output

2048

System message

Exited with return code 0
Test case #4
Accepted
Score: 100
Time: 5 ms
Memory: 380 KiB

Input file

20
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288

Output file

1048576

Your output

1048576

System message

Exited with return code 0
Test case #5
Accepted
Score: 100
Time: 5 ms
Memory: 380 KiB

Input file

29
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2
<70 bytes omitted>

Output file

536870912

Your output

536870912

System message

Exited with return code 0
Test case #6
Accepted
Score: 100
Time: 7 ms
Memory: 364 KiB

Input file

30
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2
<80 bytes omitted>

Output file

1073741824

Your output

1073741824

System message

Exited with return code 0
Subtask #4
Accepted
Score: 45
Test case #1
Accepted
Score: 100
Time: 12 ms
Memory: 452 KiB

Input file

3
1 2 4

Output file

8

Your output

8

System message

Exited with return code 0
Test case #2
Accepted
Score: 100
Time: 12 ms
Memory: 420 KiB

Input file

6
2 1 1 2 6 23

Output file

13

Your output

13

System message

Exited with return code 0
Test case #3
Accepted
Score: 100
Time: 13 ms
Memory: 416 KiB

Input file

4
3 1 1 775

Output file

6

Your output

6

System message

Exited with return code 0
Test case #4
Accepted
Score: 100
Time: 12 ms
Memory: 476 KiB

Input file

6
151 2 4 444 755 1

Output file

8

Your output

8

System message

Exited with return code 0
Test case #5
Accepted
Score: 100
Time: 13 ms
Memory: 332 KiB

Input file

10
9 2 12 1740 12 4 1 1 1 5

Output file

48

Your output

48

System message

Exited with return code 0
Test case #6
Accepted
Score: 100
Time: 12 ms
Memory: 436 KiB

Input file

16
90 97 11 218 110 21 38 27 15 1 63 87 50 320 76 257

Output file

2

Your output

2

System message

Exited with return code 0
Test case #7
Accepted
Score: 100
Time: 13 ms
Memory: 440 KiB

Input file

17
1 23 36 121 117 282 247 3 96 136 3 141 21 2 2 34 24

Output file

12

Your output

12

System message

Exited with return code 0
Test case #8
Accepted
Score: 100
Time: 14 ms
Memory: 476 KiB

Input file

20
5 30 2 13 2 68 1 32 2 9 34 6 15 21 8 14 2 16 10 6

Output file

297

Your output

297

System message

Exited with return code 0
Test case #9
Accepted
Score: 100
Time: 5 ms
Memory: 252 KiB

Input file

26
35 459 86 1 77 20 52 133 226 2 12 98 1 97 26 18 30 180 10 26 58 24 3 2 13 73

Output file

1763

Your output

1763

System message

Exited with return code 0
Test case #10
Accepted
Score: 100
Time: 7 ms
Memory: 252 KiB

Input file

31
11 42 1 33 14 6 8 123 16 1 29 25 1 17 88 44 43 61 31 38 21 18 30 28 4 60 25 7 5 20 2

Output file

853

Your output

853

System message

Exited with return code 0
Test case #11
Accepted
Score: 100
Time: 3 ms
Memory: 364 KiB

Input file

94
10 49 14 12 27 23 25 23 17 13 19 1 6 8 2 18 17 23 23 14 11 14 1 1 10 2 12 2 9 17 4 3 51 52 15 23 
<149 bytes omitted>

Output file

1530

Your output

1530

System message

Exited with return code 0
Test case #12
Accepted
Score: 100
Time: 7 ms
Memory: 368 KiB

Input file

493
3 5 1 1 8 2 1 6 1 3 2 1 6 3 4 1 2 5 3 2 2 3 7 1 4 2 11 2 7 3 4 2 4 2 2 2 5 2 5 3 6 1 1 2 5 3 3 1
<928 bytes omitted>

Output file

1978

Your output

1978

System message

Exited with return code 0
Test case #13
Accepted
Score: 100
Time: 9 ms
Memory: 376 KiB

Input file

877
1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 
<1658 bytes omitted>

Output file

953

Your output

953

System message

Exited with return code 0
Test case #14
Accepted
Score: 100
Time: 4 ms
Memory: 372 KiB

Input file

1922
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1
<3749 bytes omitted>

Output file

2001

Your output

2001

System message

Exited with return code 0
Test case #15
Accepted
Score: 100
Time: 7 ms
Memory: 380 KiB

Input file

2000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
<3905 bytes omitted>

Output file

2001

Your output

2001

System message

Exited with return code 0
Test case #16
Accepted
Score: 100
Time: 16 ms
Memory: 432 KiB

Input file

10
1 2 4 8 16 32 64 128 256 512

Output file

1024

Your output

1024

System message

Exited with return code 0
Test case #17
Accepted
Score: 100
Time: 5 ms
Memory: 368 KiB

Input file

11
1 2 4 8 16 32 64 128 256 512 1024

Output file

2048

Your output

2048

System message

Exited with return code 0
Test case #18
Accepted
Score: 100
Time: 5 ms
Memory: 380 KiB

Input file

20
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288

Output file

1048576

Your output

1048576

System message

Exited with return code 0
Test case #19
Accepted
Score: 100
Time: 5 ms
Memory: 380 KiB

Input file

29
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2
<70 bytes omitted>

Output file

536870912

Your output

536870912

System message

Exited with return code 0
Test case #20
Accepted
Score: 100
Time: 7 ms
Memory: 364 KiB

Input file

30
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2
<80 bytes omitted>

Output file

1073741824

Your output

1073741824

System message

Exited with return code 0
Test case #21
Accepted
Score: 100
Time: 4 ms
Memory: 380 KiB

Input file

2127
5059570 569700433 806431662 781669463 169065993 701953063 939155635 579816057 127813190 1989805
<20754 bytes omitted>

Output file

1042074992108

Your output

1042074992108

System message

Exited with return code 0
Test case #22
Accepted
Score: 100
Time: 20 ms
Memory: 496 KiB

Input file

22905
240541707 227409131 433416478 685346829 819315210 484763086 236512049 887542996 613083819 3769
<226195 bytes omitted>

Output file

11375707640172

Your output

11375707640172

System message

Exited with return code 0
Test case #23
Accepted
Score: 100
Time: 37 ms
Memory: 860 KiB

Input file

54470
577279446 750838456 663029421 360438188 573750548 672784477 678743584 936752454 954554014 8760
<538237 bytes omitted>

Output file

27114831761015

Your output

27114831761015

System message

Exited with return code 0
Test case #24
Accepted
Score: 100
Time: 64 ms
Memory: 1508 KiB

Input file

159379
976409421 250650118 421653057 724935506 120104032 547412854 947887672 709870676 30178795 6887
<1575937 bytes omitted>

Output file

79673555983003

Your output

79673555983003

System message

Exited with return code 0
Test case #25
Accepted
Score: 100
Time: 86 ms
Memory: 1904 KiB

Input file

199998
676635684 106344327 103654894 304004394 476965277 902487108 473401831 646687246 84331263 7165
<1977518 bytes omitted>

Output file

99904452090076

Your output

99904452090076

System message

Exited with return code 0
Test case #26
Accepted
Score: 100
Time: 92 ms
Memory: 2140 KiB

Input file

200000
842472273 810837207 243997229 775916173 27596570 546278772 297223732 675243416 161973914 1729
<1977496 bytes omitted>

Output file

99798399886874

Your output

99798399886874

System message

Exited with return code 0