Submission ID Problem Status Score Time Memory Code / Answer files User Submit time
#17856 #58. 剩菜 Leftovers Accepted 100 1873 ms 620 K C++ 11 / 1.1 K root 2023-07-15 13:17:38
Show orginal code
#include <bits/stdc++.h>

using namespace std;

int cnt[7];

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

    for (int i = 0; i < n; i++) {
        int x;
        scanf("%d", &x);
        cnt[x]++;
    }

    int res = 0;
    int tmp;

    {
        // 1 man table
        tmp = min(a, cnt[1]);
        res += tmp;
        cnt[1] -= tmp;
    }

    {
        // 2 man table
        for (int i = 2; i >= 1; i--) {
            tmp = min(b, cnt[i]);
            res += i * tmp;
            cnt[i] -= tmp;
            b -= tmp;
        }
    }

    {
        // 4 man table
        for (int i = 4; i >= 2; i--) {
            tmp = min(c, cnt[i]);
            res += i * tmp;
            cnt[i] -= tmp;
            c -= tmp;
        }

        tmp = min(2 * c, cnt[1]);
        res += tmp;
        cnt[1] -= tmp;
    }

    {
        // 6 man table
        for (int i = 6; i >= 3; i--) {
            tmp = min(d, cnt[i]);
            res += i * tmp;
            cnt[i] -= tmp;
            d -= tmp;
        }

        tmp = min(d, cnt[2]);
        int tmp1 = min(tmp, cnt[1]);
        res += 2 * tmp + tmp1;
        cnt[2] -= tmp;
        cnt[1] -= tmp1;
        d -= tmp;

        tmp = min(3 * d, cnt[1]);
        res += tmp;
        cnt[1] -= tmp;
    }

    printf("%d\n", res);
}
Subtask #1
Accepted
Score: 18
Test case #1
Accepted
Score: 100
Time: 6 ms
Memory: 380 KiB

Input file

7 1 1 1 1
1 1 1 1 1 1 1

Output file

7

Your output

7

System message

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

Input file

86 0 0 0 29
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<84 bytes omitted>

Output file

86

Your output

86

System message

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

Input file

92 0 0 0 31
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<96 bytes omitted>

Output file

92

Your output

92

System message

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

Input file

95 0 0 0 32
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<102 bytes omitted>

Output file

95

Your output

95

System message

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

Input file

98 0 0 0 33
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<108 bytes omitted>

Output file

98

Your output

98

System message

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

Input file

89 0 0 0 30
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<90 bytes omitted>

Output file

89

Your output

89

System message

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

Input file

99 0 0 20 19
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
<111 bytes omitted>

Output file

97

Your output

97

System message

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

Input file

100 13 4 6 12
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<114 bytes omitted>

Output file

65

Your output

65

System message

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

Input file

2 0 0 0 1
1 1

Output file

2

Your output

2

System message

Exited with return code 0
Subtask #2
Accepted
Score: 21
Test case #1
Accepted
Score: 100
Time: 6 ms
Memory: 376 KiB

Input file

4 0 0 0 2
2 2 1 1

Output file

6

Your output

6

System message

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

Input file

3 0 0 0 1
1 2 1

Output file

3

Your output

3

System message

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

Input file

98 0 0 0 20
1 1 2 1 3 1 2 3 2 3 3 3 1 1 2 1 1 3 2 1 2 2 1 2 2 1 2 3 1 2 2 2 2 1 3 1 2 2 3 2 3 2 2 1 
<108 bytes omitted>

Output file

60

Your output

60

System message

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

Input file

99 0 0 0 9
3 2 2 1 1 1 1 1 1 2 1 3 3 3 2 3 3 1 1 2 1 2 3 2 1 1 1 2 3 1 3 3 3 3 2 3 1 3 2 3 1 3 3 1 2
<109 bytes omitted>

Output file

27

Your output

27

System message

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

Input file

100 0 0 0 13
2 1 3 1 3 3 1 1 3 1 1 3 2 1 3 1 1 3 3 2 2 3 1 1 2 3 2 2 3 1 1 2 3 2 1 2 2 3 3 1 1 3 1 2
<113 bytes omitted>

Output file

39

Your output

39

System message

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

Input file

99 0 0 0 0
6 6 5 5 1 4 1 1 4 4 2 4 3 3 3 2 3 6 4 1 2 4 2 6 5 1 1 1 2 6 4 6 3 6 3 2 3 4 6 2 3 1 6 6 4
<109 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

100 0 0 0 0
5 2 4 3 4 6 3 1 4 6 1 4 6 2 4 6 1 1 6 6 2 5 3 1 1 2 6 5 5 6 1 1 2 3 5 1 5 2 6 6 4 4 6 1 
<112 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

86 0 0 0 29
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<84 bytes omitted>

Output file

86

Your output

86

System message

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

Input file

92 0 0 0 31
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<96 bytes omitted>

Output file

92

Your output

92

System message

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

Input file

95 0 0 0 32
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<102 bytes omitted>

Output file

95

Your output

95

System message

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

Input file

98 0 0 0 33
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<108 bytes omitted>

Output file

98

Your output

98

System message

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

Input file

99 0 0 0 87
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 
<110 bytes omitted>

Output file

279

Your output

279

System message

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

Input file

100 0 0 0 73
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
<113 bytes omitted>

Output file

198

Your output

198

System message

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

Input file

89 0 0 0 30
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<90 bytes omitted>

Output file

89

Your output

89

System message

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

Input file

2 0 0 0 1
1 1

Output file

2

Your output

2

System message

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

Input file

6 1000000 1000000 2 3
3 3 4 4 5 6

Output file

22

Your output

22

System message

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

Input file

99 9 7 54 47
3 3 4 5 3 6 6 4 6 5 3 3 4 5 4 6 5 4 4 4 6 3 3 5 5 4 6 4 4 5 4 5 6 3 4 4 6 5 5 4 6 6 5 5
<111 bytes omitted>

Output file

425

Your output

425

System message

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

Input file

100 13 76 4 88
3 6 6 3 3 6 6 3 6 6 6 4 4 3 3 4 4 4 3 5 3 3 4 4 3 5 6 5 5 6 5 5 3 5 4 4 4 6 4 4 3 3 6
<115 bytes omitted>

Output file

428

Your output

428

System message

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

Input file

99 7 47 0 0
3 3 4 5 3 6 6 4 6 5 3 3 4 5 4 6 5 4 4 4 6 3 3 5 5 4 6 4 4 5 4 5 6 3 4 4 6 5 5 4 6 6 5 5 
<110 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

100 13 4 0 0
3 6 6 3 3 6 6 3 6 6 6 4 4 3 3 4 4 4 3 5 3 3 4 4 3 5 6 5 5 6 5 5 3 5 4 4 4 6 4 4 3 3 6 4
<113 bytes omitted>

Output file

0

Your output

0

System message

Exited with return code 0
Subtask #4
Accepted
Score: 22
Test case #1
Accepted
Score: 100
Time: 6 ms
Memory: 380 KiB

Input file

4 0 0 2 0
1 1 2 3

Output file

5

Your output

5

System message

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

Input file

4 0 0 0 2
2 2 1 1

Output file

6

Your output

6

System message

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

Input file

3 0 0 0 1
1 2 1

Output file

3

Your output

3

System message

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

Input file

4 0 0 1 1
1 1 2 4

Output file

7

Your output

7

System message

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

Input file

3 2 0 1 0
1 1 2

Output file

4

Your output

4

System message

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

Input file

3 0 0 1 1
4 2 1

Output file

7

Your output

7

System message

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

Input file

3 0 0 2 0
3 2 1

Output file

5

Your output

5

System message

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

Input file

5 1000000 0 0 0
1 1 6 1 2

Output file

3

Your output

3

System message

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

Input file

7 1 1 1 1
1 1 1 1 1 1 1

Output file

7

Your output

7

System message

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

Input file

6 1000000 1000000 2 3
3 3 4 4 5 6

Output file

22

Your output

22

System message

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

Input file

4 0 0 1 1
1 1 1 3

Output file

6

Your output

6

System message

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

Input file

99 0 0 7 48
3 1 3 1 1 1 3 1 3 3 1 1 3 3 3 1 1 3 1 1 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 1 1 1 1 3 
<110 bytes omitted>

Output file

165

Your output

165

System message

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

Input file

100 0 0 4 12
1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1
<113 bytes omitted>

Output file

48

Your output

48

System message

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

Input file

98 0 0 0 20
1 1 2 1 3 1 2 3 2 3 3 3 1 1 2 1 1 3 2 1 2 2 1 2 2 1 2 3 1 2 2 2 2 1 3 1 2 2 3 2 3 2 2 1 
<108 bytes omitted>

Output file

60

Your output

60

System message

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

Input file

99 0 0 0 9
3 2 2 1 1 1 1 1 1 2 1 3 3 3 2 3 3 1 1 2 1 2 3 2 1 1 1 2 3 1 3 3 3 3 2 3 1 3 2 3 1 3 3 1 2
<109 bytes omitted>

Output file

27

Your output

27

System message

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

Input file

100 0 0 0 13
2 1 3 1 3 3 1 1 3 1 1 3 2 1 3 1 1 3 3 2 2 3 1 1 2 3 2 2 3 1 1 2 3 2 1 2 2 3 3 1 1 3 1 2
<113 bytes omitted>

Output file

39

Your output

39

System message

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

Input file

99 9 7 54 47
3 3 4 5 3 6 6 4 6 5 3 3 4 5 4 6 5 4 4 4 6 3 3 5 5 4 6 4 4 5 4 5 6 3 4 4 6 5 5 4 6 6 5 5
<111 bytes omitted>

Output file

425

Your output

425

System message

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

Input file

100 13 76 4 88
3 6 6 3 3 6 6 3 6 6 6 4 4 3 3 4 4 4 3 5 3 3 4 4 3 5 6 5 5 6 5 5 3 5 4 4 4 6 4 4 3 3 6
<115 bytes omitted>

Output file

428

Your output

428

System message

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

Input file

99 9 7 47 60
1 4 1 1 4 4 2 4 3 3 3 2 3 6 4 1 2 4 2 6 5 1 1 1 2 6 4 6 3 6 3 2 3 4 6 2 3 1 6 6 4 5 1 1
<111 bytes omitted>

Output file

317

Your output

317

System message

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

Input file

100 13 76 4 6
4 6 3 1 4 6 1 4 6 2 4 6 1 1 6 6 2 5 3 1 1 2 6 5 5 6 1 1 2 3 5 1 5 2 6 6 4 4 6 1 5 4 6 
<114 bytes omitted>

Output file

96

Your output

96

System message

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

Input file

98 20 22 35 5
2 1 3 4 2 1 6 2 6 1 1 3 3 2 1 1 1 1 1 1 1 1 1 1 2 2 1 1 3 2 5 2 5 4 1 1 4 2 6 5 2 4 5 
<110 bytes omitted>

Output file

164

Your output

164

System message

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

Input file

99 9 7 47 60
4 3 1 1 1 1 1 1 3 4 4 2 1 1 1 1 1 1 1 3 5 1 1 1 1 1 1 4 6 4 1 1 1 5 1 1 1 2 1 5 1 1 1 2
<111 bytes omitted>

Output file

208

Your output

208

System message

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

Input file

100 13 76 4 6
1 1 1 3 1 1 1 6 1 1 1 1 1 1 3 1 1 2 3 1 2 2 1 1 2 1 1 2 1 1 1 1 2 2 2 2 2 2 1 1 2 2 1 
<114 bytes omitted>

Output file

154

Your output

154

System message

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

Input file

99 7 1 2 60
1 1 1 1 1 1 2 1 3 3 3 2 3 3 1 1 2 1 2 3 2 1 1 1 2 3 1 3 3 3 3 2 3 1 3 2 3 1 3 3 1 2 1 1 
<110 bytes omitted>

Output file

176

Your output

176

System message

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

Input file

100 4 7 8 6
1 3 3 1 1 3 1 1 3 2 1 3 1 1 3 3 2 2 3 1 1 2 3 2 2 3 1 1 2 3 2 1 2 2 3 3 1 1 3 1 2 1 3 1 
<112 bytes omitted>

Output file

60

Your output

60

System message

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

Input file

99 0 0 7 47
2 1 1 1 1 1 1 2 1 3 3 3 2 3 3 1 1 2 1 2 3 2 1 1 1 2 3 1 3 3 3 3 2 3 1 3 2 3 1 3 3 1 2 1 
<110 bytes omitted>

Output file

162

Your output

162

System message

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

Input file

100 0 0 13 4
3 1 3 3 1 1 3 1 1 3 2 1 3 1 1 3 3 2 2 3 1 1 2 3 2 2 3 1 1 2 3 2 1 2 2 3 3 1 1 3 1 2 1 3
<113 bytes omitted>

Output file

51

Your output

51

System message

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

Input file

99 0 0 0 0
6 6 5 5 1 4 1 1 4 4 2 4 3 3 3 2 3 6 4 1 2 4 2 6 5 1 1 1 2 6 4 6 3 6 3 2 3 4 6 2 3 1 6 6 4
<109 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

100 0 0 0 0
5 2 4 3 4 6 3 1 4 6 1 4 6 2 4 6 1 1 6 6 2 5 3 1 1 2 6 5 5 6 1 1 2 3 5 1 5 2 6 6 4 4 6 1 
<112 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

99 7 47 0 0
3 3 4 5 3 6 6 4 6 5 3 3 4 5 4 6 5 4 4 4 6 3 3 5 5 4 6 4 4 5 4 5 6 3 4 4 6 5 5 4 6 6 5 5 
<110 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

100 13 4 0 0
3 6 6 3 3 6 6 3 6 6 6 4 4 3 3 4 4 4 3 5 3 3 4 4 3 5 6 5 5 6 5 5 3 5 4 4 4 6 4 4 3 3 6 4
<113 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

86 0 0 0 29
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<84 bytes omitted>

Output file

86

Your output

86

System message

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

Input file

92 0 0 0 31
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<96 bytes omitted>

Output file

92

Your output

92

System message

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

Input file

95 0 0 0 32
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<102 bytes omitted>

Output file

95

Your output

95

System message

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

Input file

98 0 0 0 33
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<108 bytes omitted>

Output file

98

Your output

98

System message

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

Input file

99 0 0 0 87
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 
<110 bytes omitted>

Output file

279

Your output

279

System message

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

Input file

100 0 0 0 73
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
<113 bytes omitted>

Output file

198

Your output

198

System message

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

Input file

89 0 0 0 30
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<90 bytes omitted>

Output file

89

Your output

89

System message

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

Input file

99 0 0 20 19
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
<111 bytes omitted>

Output file

97

Your output

97

System message

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

Input file

100 13 4 6 12
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<114 bytes omitted>

Output file

65

Your output

65

System message

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

Input file

2 0 0 0 1
1 1

Output file

2

Your output

2

System message

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

Input file

4 0 0 2 0
1 1 2 3

Output file

5

Your output

5

System message

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

Input file

4 0 0 0 2
2 2 1 1

Output file

6

Your output

6

System message

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

Input file

3 0 0 0 1
1 2 1

Output file

3

Your output

3

System message

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

Input file

4 0 0 1 1
1 1 2 4

Output file

7

Your output

7

System message

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

Input file

3 2 0 1 0
1 1 2

Output file

4

Your output

4

System message

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

Input file

3 0 0 1 1
4 2 1

Output file

7

Your output

7

System message

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

Input file

3 0 0 2 0
3 2 1

Output file

5

Your output

5

System message

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

Input file

5 1000000 0 0 0
1 1 6 1 2

Output file

3

Your output

3

System message

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

Input file

7 1 1 1 1
1 1 1 1 1 1 1

Output file

7

Your output

7

System message

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

Input file

6 1000000 1000000 2 3
3 3 4 4 5 6

Output file

22

Your output

22

System message

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

Input file

4 0 0 1 1
1 1 1 3

Output file

6

Your output

6

System message

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

Input file

999999 0 0 70729 52670
1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1
<1999921 bytes omitted>

Output file

352138

Your output

352138

System message

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

Input file

1000000 0 0 45217 35978
1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<1999924 bytes omitted>

Output file

234346

Your output

234346

System message

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

Input file

99 0 0 7 48
3 1 3 1 1 1 3 1 3 3 1 1 3 3 3 1 1 3 1 1 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 1 1 1 1 3 
<110 bytes omitted>

Output file

165

Your output

165

System message

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

Input file

100 0 0 4 12
1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1
<113 bytes omitted>

Output file

48

Your output

48

System message

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

Input file

98 0 0 0 20
1 1 2 1 3 1 2 3 2 3 3 3 1 1 2 1 1 3 2 1 2 2 1 2 2 1 2 3 1 2 2 2 2 1 3 1 2 2 3 2 3 2 2 1 
<108 bytes omitted>

Output file

60

Your output

60

System message

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

Input file

99 0 0 0 9
3 2 2 1 1 1 1 1 1 2 1 3 3 3 2 3 3 1 1 2 1 2 3 2 1 1 1 2 3 1 3 3 3 3 2 3 1 3 2 3 1 3 3 1 2
<109 bytes omitted>

Output file

27

Your output

27

System message

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

Input file

100 0 0 0 13
2 1 3 1 3 3 1 1 3 1 1 3 2 1 3 1 1 3 3 2 2 3 1 1 2 3 2 2 3 1 1 2 3 2 1 2 2 3 3 1 1 3 1 2
<113 bytes omitted>

Output file

39

Your output

39

System message

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

Input file

99 9 7 54 47
3 3 4 5 3 6 6 4 6 5 3 3 4 5 4 6 5 4 4 4 6 3 3 5 5 4 6 4 4 5 4 5 6 3 4 4 6 5 5 4 6 6 5 5
<111 bytes omitted>

Output file

425

Your output

425

System message

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

Input file

100 13 76 4 88
3 6 6 3 3 6 6 3 6 6 6 4 4 3 3 4 4 4 3 5 3 3 4 4 3 5 6 5 5 6 5 5 3 5 4 4 4 6 4 4 3 3 6
<115 bytes omitted>

Output file

428

Your output

428

System message

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

Input file

99 9 7 47 60
1 4 1 1 4 4 2 4 3 3 3 2 3 6 4 1 2 4 2 6 5 1 1 1 2 6 4 6 3 6 3 2 3 4 6 2 3 1 6 6 4 5 1 1
<111 bytes omitted>

Output file

317

Your output

317

System message

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

Input file

100 13 76 4 6
4 6 3 1 4 6 1 4 6 2 4 6 1 1 6 6 2 5 3 1 1 2 6 5 5 6 1 1 2 3 5 1 5 2 6 6 4 4 6 1 5 4 6 
<114 bytes omitted>

Output file

96

Your output

96

System message

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

Input file

98 20 22 35 5
2 1 3 4 2 1 6 2 6 1 1 3 3 2 1 1 1 1 1 1 1 1 1 1 2 2 1 1 3 2 5 2 5 4 1 1 4 2 6 5 2 4 5 
<110 bytes omitted>

Output file

164

Your output

164

System message

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

Input file

99 9 7 47 60
4 3 1 1 1 1 1 1 3 4 4 2 1 1 1 1 1 1 1 3 5 1 1 1 1 1 1 4 6 4 1 1 1 5 1 1 1 2 1 5 1 1 1 2
<111 bytes omitted>

Output file

208

Your output

208

System message

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

Input file

100 13 76 4 6
1 1 1 3 1 1 1 6 1 1 1 1 1 1 3 1 1 2 3 1 2 2 1 1 2 1 1 2 1 1 1 1 2 2 2 2 2 2 1 1 2 2 1 
<114 bytes omitted>

Output file

154

Your output

154

System message

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

Input file

99 7 1 2 60
1 1 1 1 1 1 2 1 3 3 3 2 3 3 1 1 2 1 2 3 2 1 1 1 2 3 1 3 3 3 3 2 3 1 3 2 3 1 3 3 1 2 1 1 
<110 bytes omitted>

Output file

176

Your output

176

System message

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

Input file

100 4 7 8 6
1 3 3 1 1 3 1 1 3 2 1 3 1 1 3 3 2 2 3 1 1 2 3 2 2 3 1 1 2 3 2 1 2 2 3 3 1 1 3 1 2 1 3 1 
<112 bytes omitted>

Output file

60

Your output

60

System message

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

Input file

99 0 0 7 47
2 1 1 1 1 1 1 2 1 3 3 3 2 3 3 1 1 2 1 2 3 2 1 1 1 2 3 1 3 3 3 3 2 3 1 3 2 3 1 3 3 1 2 1 
<110 bytes omitted>

Output file

162

Your output

162

System message

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

Input file

100 0 0 13 4
3 1 3 3 1 1 3 1 1 3 2 1 3 1 1 3 3 2 2 3 1 1 2 3 2 2 3 1 1 2 3 2 1 2 2 3 3 1 1 3 1 2 1 3
<113 bytes omitted>

Output file

51

Your output

51

System message

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

Input file

99 0 0 0 0
6 6 5 5 1 4 1 1 4 4 2 4 3 3 3 2 3 6 4 1 2 4 2 6 5 1 1 1 2 6 4 6 3 6 3 2 3 4 6 2 3 1 6 6 4
<109 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

100 0 0 0 0
5 2 4 3 4 6 3 1 4 6 1 4 6 2 4 6 1 1 6 6 2 5 3 1 1 2 6 5 5 6 1 1 2 3 5 1 5 2 6 6 4 4 6 1 
<112 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

99 7 47 0 0
3 3 4 5 3 6 6 4 6 5 3 3 4 5 4 6 5 4 4 4 6 3 3 5 5 4 6 4 4 5 4 5 6 3 4 4 6 5 5 4 6 6 5 5 
<110 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

100 13 4 0 0
3 6 6 3 3 6 6 3 6 6 6 4 4 3 3 4 4 4 3 5 3 3 4 4 3 5 6 5 5 6 5 5 3 5 4 4 4 6 4 4 3 3 6 4
<113 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

86 0 0 0 29
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<84 bytes omitted>

Output file

86

Your output

86

System message

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

Input file

999989 0 0 0 333330
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<1999898 bytes omitted>

Output file

999989

Your output

999989

System message

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

Input file

92 0 0 0 31
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<96 bytes omitted>

Output file

92

Your output

92

System message

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

Input file

95 0 0 0 32
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<102 bytes omitted>

Output file

95

Your output

95

System message

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

Input file

98 0 0 0 33
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<108 bytes omitted>

Output file

98

Your output

98

System message

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

Input file

99 0 0 0 87
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 
<110 bytes omitted>

Output file

279

Your output

279

System message

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

Input file

100 0 0 0 73
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
<113 bytes omitted>

Output file

198

Your output

198

System message

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

Input file

999999 256399 70729 234581 571118
1 5 4 6 5 1 2 1 5 6 4 2 4 5 1 2 4 3 6 5 3 5 6 2 2 2 6 1 6 3 5 5 5 
<1999932 bytes omitted>

Output file

3502551

Your output

3502551

System message

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

Input file

1000000 325433 53297 210558 45217
5 6 1 4 4 5 6 6 3 6 5 6 3 4 6 5 3 3 6 2 2 1 2 1 4 6 2 6 5 6 5 1 3 
<1999934 bytes omitted>

Output file

1342828

Your output

1342828

System message

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

Input file

999999 256399 70729 234581 571118
5 1 1 1 3 2 1 4 1 1 1 2 1 4 2 1 2 1 3 1 1 1 1 1 1 2 1 2 1 3 5 1 1 
<1999932 bytes omitted>

Output file

2143463

Your output

2143463

System message

Exited with return code 0
Test case #44
Accepted
Score: 100
Time: 67 ms
Memory: 248 KiB

Input file

1000000 325433 53297 210558 45217
6 6 2 1 1 1 1 4 4 4 2 1 5 1 1 1 2 1 2 1 1 1 1 1 1 1 4 5 3 1 1 1 4 
<1999934 bytes omitted>

Output file

1360241

Your output

1360241

System message

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

Input file

999999 0 0 256399 70729
3 1 2 1 3 2 1 2 1 2 3 1 2 1 2 1 2 1 3 3 2 3 2 3 2 2 2 3 1 3 3 2 2 2 2 2 2 1 
<1999922 bytes omitted>

Output file

981384

Your output

981384

System message

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

Input file

1000000 0 0 53297 210558
1 2 3 1 1 1 2 3 3 3 3 2 3 3 1 3 2 3 3 3 2 2 1 2 1 1 3 2 3 2 3 2 1 3 1 1 3 3
<1999925 bytes omitted>

Output file

791565

Your output

791565

System message

Exited with return code 0
Test case #47
Accepted
Score: 100
Time: 85 ms
Memory: 620 KiB

Input file

999999 4 5 10 571118
1 2 1 3 2 1 2 1 2 3 1 2 1 2 1 2 1 3 3 2 3 2 3 2 2 2 3 1 3 3 2 2 2 2 2 2 1 3 1 1
<1999919 bytes omitted>

Output file

1713398

Your output

1713398

System message

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

Input file

1000000 5 0 9 45217
2 3 1 1 1 2 3 3 3 3 2 3 3 1 3 2 3 3 3 2 2 1 2 1 1 3 2 3 2 3 2 1 3 1 1 3 3 3 1 2 
<1999920 bytes omitted>

Output file

135683

Your output

135683

System message

Exited with return code 0
Test case #49
Accepted
Score: 100
Time: 59 ms
Memory: 360 KiB

Input file

999999 0 0 0 0
3 3 3 3 1 5 4 6 5 1 2 1 5 6 4 2 4 5 1 2 4 3 6 5 3 5 6 2 2 2 6 1 6 3 5 5 5 5 2 2 1 6 1
<1999913 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

1000000 0 0 0 0
5 3 2 1 5 6 1 4 4 5 6 6 3 6 5 6 3 4 6 5 3 3 6 2 2 1 2 1 4 6 2 6 5 6 5 1 3 1 4 6 3 6 
<1999916 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

999999 256399 70729 0 0
3 3 5 4 4 3 3 4 5 3 4 6 6 6 3 5 4 6 3 4 3 3 3 4 6 4 4 4 3 6 3 3 3 3 5 6 4 5 
<1999922 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

1000000 53297 210558 0 0
5 3 6 3 6 6 5 6 4 3 4 5 4 3 4 4 5 3 5 4 6 4 3 4 3 6 6 4 4 5 4 5 5 3 3 6 4 5
<1999925 bytes omitted>

Output file

0

Your output

0

System message

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

Input file

999986 0 0 0 333329
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<1999892 bytes omitted>

Output file

999986

Your output

999986

System message

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

Input file

89 0 0 0 30
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<90 bytes omitted>

Output file

89

Your output

89

System message

Exited with return code 0
Test case #55
Accepted
Score: 100
Time: 53 ms
Memory: 248 KiB

Input file

999992 0 0 0 333331
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<1999904 bytes omitted>

Output file

999992

Your output

999992

System message

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

Input file

999995 0 0 0 333332
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<1999910 bytes omitted>

Output file

999995

Your output

999995

System message

Exited with return code 0
Test case #57
Accepted
Score: 100
Time: 55 ms
Memory: 348 KiB

Input file

999998 0 0 0 333333
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<1999916 bytes omitted>

Output file

999998

Your output

999998

System message

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

Input file

99 0 0 20 19
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
<111 bytes omitted>

Output file

97

Your output

97

System message

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

Input file

100 13 4 6 12
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
<114 bytes omitted>

Output file

65

Your output

65

System message

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

Input file

2 0 0 0 1
1 1

Output file

2

Your output

2

System message

Exited with return code 0