QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#877583#9070. Candy FactoryHuangHanShengWA 1ms3712kbC++20998b2025-01-31 23:34:062025-01-31 23:34:12

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

4 3
1
3
4
1

output:

3

result:

ok single line: '3'

Test #2:

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

input:

4 4
1
3
4
1

output:

7

result:

ok single line: '7'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

4 2
1
3
4
1

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

6 3
5
5
5
3
1
1

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

5 4
5
4
3
2
1

output:

5

result:

ok single line: '5'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

2 2
100
50

output:

50

result:

ok single line: '50'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

6 4
100
100
100
50
50
50

output:

2

result:

ok single line: '2'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

7 6
1
5
6
6
6
6
7

output:

5

result:

ok single line: '5'

Test #9:

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

input:

7 6
1
5
5
6
6
6
7

output:

6

result:

ok single line: '6'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

7 6
1
4
5
6
6
6
7

output:

7

result:

ok single line: '7'

Test #11:

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

input:

5000 5000
1000000000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

4998999995001

result:

ok single line: '4998999995001'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

5000 2
3
7
8
2
9
10
8
1
5
3
6
8
6
1
6
7
5
7
3
3
7
6
4
6
6
7
3
2
8
2
7
5
6
10
2
6
8
2
6
5
8
4
3
4
3
4
9
6
4
9
8
6
3
1
7
8
8
2
3
5
9
5
2
7
9
6
10
3
1
2
6
4
8
9
2
8
9
8
6
10
1
1
7
1
9
3
2
1
2
7
6
4
2
9
6
6
2
1
1
10
10
9
1
9
2
6
5
9
3
4
5
4
8
6
8
8
3
7
2
2
7
2
7
8
3
2
9
5
6
7
6
5
1
2
8
10
6
10
6
6
5
7
3...

output:

1

result:

ok single line: '1'

Test #13:

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

input:

5000 7
9
3
9
9
6
1
4
3
8
9
4
3
10
5
2
5
1
4
1
5
8
1
2
4
9
6
9
3
2
2
3
10
7
4
5
3
3
1
8
10
8
10
5
4
9
1
7
4
4
7
6
8
2
7
9
7
8
6
4
5
1
5
5
3
8
4
9
9
6
8
6
5
1
3
8
6
2
10
2
9
6
9
10
9
9
1
3
4
4
6
10
2
7
9
7
4
8
5
4
6
5
10
9
1
7
2
3
10
7
4
5
1
7
10
1
10
5
7
9
10
9
2
5
3
5
1
6
10
10
5
10
5
4
1
7
2
8
10
8...

output:

3

result:

ok single line: '3'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

5000 137
40
40
41
7
27
22
14
30
4
26
6
22
3
33
43
6
27
18
14
2
46
46
17
47
32
5
4
7
23
28
31
27
20
13
11
48
32
46
31
37
37
48
12
15
23
11
30
37
4
10
5
20
46
43
14
16
23
5
16
5
29
35
40
18
18
30
50
48
24
42
18
15
39
23
28
34
43
26
44
36
47
37
48
33
17
41
27
50
49
5
47
15
26
3
31
31
14
6
24
18
20
4
46...

output:

34

result:

ok single line: '34'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

5000 621
17
7
15
6
17
13
44
44
34
9
17
15
20
19
22
29
28
21
43
24
4
32
39
49
2
36
13
48
36
45
13
17
34
26
12
29
1
13
50
35
4
25
20
5
6
30
21
20
26
34
18
4
38
7
19
3
20
42
49
2
8
31
6
4
39
23
40
42
9
1
19
29
28
29
6
47
31
36
6
50
40
15
19
3
21
7
12
42
30
33
25
15
49
49
39
9
5
8
30
42
47
27
4
43
48
31...

output:

263

result:

ok single line: '263'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

5000 2548
5
4
16
34
6
22
33
14
27
41
21
32
23
38
18
17
12
17
34
27
39
48
23
21
29
49
27
33
28
19
7
43
19
26
1
2
13
15
9
9
29
41
42
30
27
6
16
42
32
21
6
25
11
46
6
44
19
40
3
4
31
19
50
14
32
41
21
33
24
40
41
20
3
26
17
45
6
25
33
39
30
28
46
44
3
35
43
13
45
9
39
46
32
17
18
34
24
17
27
9
45
47
33...

output:

90

result:

ok single line: '90'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

5000 4276
26
26
32
32
25
12
38
19
24
36
24
45
10
24
29
6
18
45
18
38
42
8
45
32
4
24
11
22
35
27
27
29
38
32
4
26
31
34
43
2
9
46
43
15
12
9
24
31
41
11
24
49
26
38
1
34
4
22
39
22
8
26
41
11
28
14
26
36
17
9
42
15
50
27
17
9
7
24
41
3
11
44
46
10
48
40
28
45
29
5
31
12
50
15
17
43
18
24
3
47
30
29
...

output:

85933

result:

ok single line: '85933'

Test #18:

score: -100
Wrong Answer
time: 1ms
memory: 3584kb

input:

5000 2
491692224
465461918
633893589
234388088
140842638
312990555
460928848
105968808
604122527
123080145
312065793
554735673
244064573
648460749
399871829
869116078
264645154
542519368
91784000
765807220
222778886
833504276
651880147
571326150
182056966
676142473
130510618
590642938
168899991
5279...

output:

-2508181843755

result:

wrong answer 1st lines differ - expected: '1', found: '-2508181843755'