CSES - Datatähti 2017 alku - Results
Submission details
Task:Kolikot
Sender:tulir293
Submission time:2016-10-04 13:50:09 +0300
Language:Python3
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.06 s1details
#20.06 s1details
#30.06 s1details
#40.06 s1details
#50.06 s1details
#60.06 s2details
#70.06 s2details
#80.06 s2details
#90.06 s2details
#100.06 s2details
#110.08 s3details
#120.06 s3details
#130.08 s3details
#140.06 s3details
#150.06 s3details
#160.07 s3details

Code

#!/usr/bin/python3
def quicksort(array):
    less = []
    equal = []
    greater = []

    if len(array) > 1:
        pivot = array[0]
        for x in array:
            if x < pivot:
                less.append(x)
            if x == pivot:
                equal.append(x)
            if x > pivot:
                greater.append(x)
        return quicksort(less) + equal + quicksort(greater)
    else:
        return array


arr = []
for i in range(int(input())):
	arr.append(int(input()))

arr = quicksort(arr)

res = 1
i = 0
while i < len(arr) and arr[i] <= res:
	res = res + arr[i]
	i = i + 1

print(res)

Test details

Test 1

Group: 1

Verdict:

input
10
5 3 1 4 5 1 3 2 2 3

correct output
30

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '5 3 1 4 5 1 3 2 2 3'

Test 2

Group: 1

Verdict:

input
10
3 5 5 4 5 4 5 5 5 3

correct output
1

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '3 5 5 4 5 4 5 5 5 3'

Test 3

Group: 1

Verdict:

input
10
10 9 2 8 7 10 7 1 5 2

correct output
62

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '10 9 2 8 7 10 7 1 5 2'

Test 4

Group: 1

Verdict:

input
10
7 4 6 3 9 7 4 4 7 7

correct output
1

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '7 4 6 3 9 7 4 4 7 7'

Test 5

Group: 1

Verdict:

input
10
8 2 1 7 9 7 5 2 4 5

correct output
51

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '8 2 1 7 9 7 5 2 4 5'

Test 6

Group: 2

Verdict:

input
100
3 3 1 4 2 1 2 1 3 1 2 5 1 5 1 ...

correct output
269

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '3 3 1 4 2 1 2 1 3 1 2 5 1 5 1 1 3 4 4 1 4 4 4 1 3 5 1 1 4 3 5 2 2 3 2 3 2 1 3 2 1 4 1 4 2 5 1 4 2 2 2 4 1 3 3 5 4 3 3 1 1 5 1 4 5 2 3 1 3 5 1 3 4 5 3 2 2 2 3 1 2 5 1 3 1 3 5 1 1 4 2 2 3 3 4 5 1 1 4 3

Test 7

Group: 2

Verdict:

input
100
3 3 2 3 4 5 4 4 4 4 2 2 4 4 4 ...

correct output
1

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '3 3 2 3 4 5 4 4 4 4 2 2 4 4 4 2 3 3 4 2 5 5 3 4 2 5 4 4 2 5 3 2 3 3 2 5 2 2 5 5 2 3 4 4 5 2 5 2 4 3 2 5 5 5 4 5 2 4 4 4 2 4 2 5 4 2 3 2 2 2 2 3 4 4 2 5 4 4 2 4 2 2 4 4 4 4 3 5 3 3 2 5 4 4 2 2 4 3 2 3

Test 8

Group: 2

Verdict:

input
100
678 999 374 759 437 390 832 54...

correct output
1

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '678 999 374 759 437 390 832 546 519 954 38 995 872 883 446 617 687 536 801 407 351 436 612 458 864 861 117 479 702 958 401 519 310 189 737 117 341 102 91 244 636 529 685 347 907 290 17 112 24 956 61

Test 9

Group: 2

Verdict:

input
100
862 537 633 807 666 248 237 5 ...

correct output
30

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '862 537 633 807 666 248 237 5 366 528 448 653 287 120 983 83 179 848 481 685 996 204 469 446 724 42 796 505 408 155 366 797 1 5 417 120 240 33 284 149 849 472 745 609 5 399 841 3 1 818 348 286 495 42

Test 10

Group: 2

Verdict:

input
100
874 302 384 920 76 28 762 163 ...

correct output
41765

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '874 302 384 920 76 28 762 163 125 2 2 3 233 324 383 1 925 884 290 23 853 577 221 553 421 447 423 5 535 148 487 765 256 188 828 87 895 3 907 837 108 409 882 463 649 74 965 493 178 186 3 246 5 467 870

Test 11

Group: 3

Verdict:

input
100000
4 2 5 3 2 3 5 2 2 2 3 4 3 3 2 ...

correct output
299640

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '4 2 5 3 2 3 5 2 2 2 3 4 3 3 2 5 5 1 2 2 2 2 2 4 2 5 1 1 5 2 1 5 4 1 3 4 2 1 4 5 3 3 1 2 5 1 3 5 2 3 2 1 1 1 3 2 5 4 3 3 3 2 2 1 4 4 2 2 3 3 4 5 4 4 1 4 1 3 2 4 2 1 2 5 5 4 3 5 3 4 3 4 1 3 5 3 5 5 4 5

Test 12

Group: 3

Verdict:

input
100000
2 5 5 5 5 2 4 4 3 2 3 2 5 5 3 ...

correct output
1

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '2 5 5 5 5 2 4 4 3 2 3 2 5 5 3 3 3 2 3 2 4 2 3 4 2 5 5 4 5 4 2 2 5 4 3 2 4 5 3 3 5 4 3 4 2 2 4 2 5 5 3 4 3 3 3 2 2 3 3 2 2 4 2 5 3 3 3 2 3 3 2 5 2 5 3 5 3 2 5 4 4 4 4 3 5 3 3 3 5 4 4 5 5 2 2 5 3 3 4 2

Test 13

Group: 3

Verdict:

input
100000
98146842 766872135 84108268 28...

correct output
1

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '98146842 766872135 84108268 281838779 586922039 328682700 470001386 398984281 443320764 593621890 977129199 275024828 626855808 25873276 270935282 377010071 678043031 376454808 943699976 474845275 84

Test 14

Group: 3

Verdict:

input
100000
932032495 1 849176169 78948957...

correct output
29970

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '932032495 1 849176169 789489571 709923161 487068944 195239853 1 5 599074312 5 771159490 811609167 388407467 395240354 193807766 760481173 913443973 3 514193019 398321022 647003474 189398473 596773837

Test 15

Group: 3

Verdict:

input
100000
35894853 796619259 699878597 4...

correct output
44965249639582

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '35894853 796619259 699878597 450101230 350785181 359965097 217490478 228043074 310870180 466056342 65439048 49365819 599375455 765390072 265213959 106379783 722800478 612888049 419758686 396482548 68

Test 16

Group: 3

Verdict:

input
100000
930494676 960662779 904422858 ...

correct output
800020001

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 23, in <module>
    arr.append(int(input()))
ValueError: invalid literal for int() with base 10: '930494676 960662779 904422858 872530233 911424972 976005690 980765298 37199 917577103 801886967 4079 969414905 861480121 14463 37911 818484707 2117 8911 995256238 957224804 33476 4746 860634610 83514