CSES - Datatähti 2017 alku - Results
Submission details
Task:Kolikot
Sender:tulir293
Submission time:2016-10-04 13:51:30 +0300
Language:Python2
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.06 s1details
#20.07 s1details
#30.07 s1details
#40.06 s1details
#50.06 s1details
#60.05 s2details
#70.07 s2details
#80.05 s2details
#90.05 s2details
#100.05 s2details
#110.06 s3details
#120.06 s3details
#130.07 s3details
#140.05 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()))
  File "<string>", line 1
    5 3 1 4 5 1 3 2 2 3
      ^
SyntaxError: invalid syntax

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()))
  File "<string>", line 1
    3 5 5 4 5 4 5 5 5 3
      ^
SyntaxError: invalid syntax

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()))
  File "<string>", line 1
    10 9 2 8 7 10 7 1 5 2
       ^
SyntaxError: invalid syntax

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()))
  File "<string>", line 1
    7 4 6 3 9 7 4 4 7 7
      ^
SyntaxError: invalid syntax

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()))
  File "<string>", line 1
    8 2 1 7 9 7 5 2 4 5
      ^
SyntaxError: invalid syntax

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()))
  File "<string>", line 1
    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
      ^
SyntaxError: invalid syntax

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()))
  File "<string>", line 1
    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
      ^
SyntaxError: invalid syntax

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()))
  File "<string>", line 1
    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 306 284 59 835 562 499 512 139 895 410 306 851 800 493 311 85 919 234 630 571 205 922 901 411 545 862 134 301 36 341 852 211 838 321 568 655 222 241 50 408 455 419 607 703 349 403 896 467 776
          ^
SyntaxError: invalid syntax

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()))
  File "<string>", line 1
    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 429 898 832 870 165 676 317 349 952 721 290 632 94 471 77 389 279 238 963 920 506 701 5 422 839 553 1 563 1 494 578 515 75 182 488 733 500 2 305 689 704 439 485 610 313 481 644
          ^
SyntaxError: invalid syntax

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()))
  File "<string>", line 1
    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 228 988 991 141 935 281 937 177 257 199 651 630 581 186 229 1 411 625 710 179 886 2 302 506 145 823 757 215 785 997 5 473 270 3 920 562 208 503 690 62 88 325 458 302 2
          ^
SyntaxError: invalid syntax

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()))
  File "<string>", line 1
    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 2 2 2 2 2 2 1 3 3 4 4 5 2 3 1 1 2 2 2 5 2 2 5 3 4 2 4 5 4 1 2 3 1 3 3 1 5 3 3 3 4 4 3 2 4 2 1 2 4 4 3 1 4 4 1 3 1 4 4 1 3 1 2 5 4 4 5 1 2 5 1 2 5 2 5 5 3 2 1 3 2 1 1 5 3 3 2 4 5 5 3 5 3 3 3 5 4 2 4 5 2 1 5 2 5 2 3 5 1 1 5 2 4 3 4 4 3 2 5 4 4 4 5 3 1 5 4 3 4 5 5 4 4 4 4 3 1 1 4 3 4 3 5 4 2 5 5 3 1 1 5 5 1 4 3 3 4 4 4 2 1 2 3 5 5 5 1 1 5 2 3 2 3 5 1 5 3 2 5 2 3 4 5 1 1 1 4 3 5 4 5 5 5 3 5 4 3 1 4 1 2 3 2 2 4 3 3 5 2 4 4 2 2 3 1 1 1 5 1 5 3 5 5 1 4 3 3 2 2 1 4 2 1 4 3 3 4 4 3 3 5 4 1 5 1 2 3 3 2 1 5 1 5 4 4 4 2 2 4 1 5 5 5 2 5 5 5 3 3 1 3 1 2 3 5 4 1 5 2 2 1 5 3 1 4 1 3 5 1 1 5 4 5 4 3 3 2 4 3 5 4 5 2 4 2 3 2 1 2 4 5 2 4 5 4 1 4 1 2 3 5 1 2 5 5 4 2 3 4 1 3...

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()))
  File "<string>", line 1
    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 3 4 3 3 4 3 5 2 4 5 5 2 5 5 2 5 3 2 2 5 4 2 5 5 4 4 3 4 3 3 2 2 3 2 3 3 5 2 5 5 5 5 2 3 4 2 3 5 3 3 5 2 5 2 5 4 5 2 4 2 3 4 5 3 2 5 3 5 5 3 2 2 5 4 3 3 2 4 5 5 2 5 2 3 4 3 2 2 4 5 3 2 2 5 5 4 4 3 5 5 5 5 2 3 2 3 5 3 3 4 3 5 2 4 2 4 5 5 4 2 5 2 2 3 5 3 2 3 5 4 2 3 2 3 4 3 3 4 4 2 2 4 3 2 2 4 3 4 5 4 5 5 4 3 3 2 3 5 2 3 3 3 5 5 3 2 2 4 3 2 4 3 2 4 3 2 4 2 5 3 4 2 4 2 2 5 4 2 5 2 4 3 2 5 3 2 3 2 3 2 5 4 4 4 4 2 5 5 5 5 4 3 5 4 4 3 5 3 3 3 5 5 4 4 3 3 3 4 2 3 2 3 4 3 2 3 4 4 2 2 5 2 4 4 5 3 5 2 4 3 2 4 3 2 5 3 4 3 5 2 3 5 4 5 5 4 4 5 2 5 4 3 3 2 5 3 5 2 3 5 3 2 4 2 5 4 4 3 2 4 2 5 5 5 3 5 2 4 2 2 5 4 3 4 5 2 5 5 2 4 3 3 5 4 3 4 5 2 3 3 2 5 2 2 3 3 3 5 4 2 3...

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()))
  File "<string>", line 1
    98146842 766872135 84108268 281838779 586922039 328682700 470001386 398984281 443320764 593621890 977129199 275024828 626855808 25873276 270935282 377010071 678043031 376454808 943699976 474845275 846028932 648778318 299525408 634942721 24020097 569101251 863653218 929673243 924773664 387798565 95446495 107865438 939733658 324725194 667165836 285509783 422666672 563351845 301348313 642954609 198125357 661838273 129926399 310525774 113351932 779775137 994470510 370371446 329282090 630075061 248824305 968646378 847627232 162980541 41327239 177550962 234726110 370383489 675806431 691923819 112099045 95451997 680449272 477505641 675787696 801253218 38722498 838384642 693647249 757580380 126725477 732036696 54472520 715408686 582664272 830842870 233476788 874966678 893659454 256457263 618332143 836480541 20165681 31147352 772703050 924908372 831056945 47...

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()))
  File "<string>", line 1
    932032495 1 849176169 789489571 709923161 487068944 195239853 1 5 599074312 5 771159490 811609167 388407467 395240354 193807766 760481173 913443973 3 514193019 398321022 647003474 189398473 596773837 5 868445478 965632635 214558193 627272016 663961500 155123720 3 733421534 273825188 879792776 283591208 338973650 664024329 315908788 3 867805691 452973653 703659214 536432425 810981142 517033544 693886266 138849763 348785821 231807605 827795964 87063114 888382330 631719140 814078420 97409374 4 401960402 2683375 338106142 489138787 649870189 916496727 851716183 850922852 131743297 535283255 151654750 2 488417723 5 44468713 763642947 111003663 847114649 108011770 171061878 602634935 917549453 325667166 544546880 539302790 316316145 4 806820645 571071626 871212176 53877507 251955510 798271072 842074356 56277150 820068618 417201497 865687646 745287695 1426...

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()))
  File "<string>", line 1
    35894853 796619259 699878597 450101230 350785181 359965097 217490478 228043074 310870180 466056342 65439048 49365819 599375455 765390072 265213959 106379783 722800478 612888049 419758686 396482548 683714536 875104044 350168946 1 205610678 528150873 178736 200378724 3 68173186 383993493 266569533 586530021 508965098 110500973 754648247 382077969 794278688 939072895 28167377 608725326 978623913 840628511 1 121855318 28771374 239573125 308675278 281268956 947006174 393084762 114698045 5 424021564 5 360980063 255649214 842385988 762972554 972570419 130873931 944570109 293515837 990201977 369588913 2 674353078 238272 662153597 85763945 185554404 474607923 600784130 837342004 776236138 957652973 272680421 639735107 919999452 914316891 1 211207217 613832846 843763202 832378763 864109859 609863619 2 836241059 2 721217030 605160965 508664326 858012150 182404...

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()))
  File "<string>", line 1
    930494676 960662779 904422858 872530233 911424972 976005690 980765298 37199 917577103 801886967 4079 969414905 861480121 14463 37911 818484707 2117 8911 995256238 957224804 33476 4746 860634610 835141878 907931876 809844705 850560236 886162268 30786 1250 992874206 904698411 803060643 951861438 888599108 932715279 882354527 827180924 860090293 969696309 810942220 907181332 929330854 952260439 966935818 930083936 886006252 38005 858611623 28648 18658 961274195 896520370 39839 38846 996457958 16553 834848298 14179 946212014 974052798 815331266 865100597 9207 908833716 21516 885016737 898979851 929431110 898289608 8143 929404908 923478118 852835561 31557 4206 971137607 16328 22233 39050 17248 908999172 12129 849212841 37724 906604304 2450 7904 806803339 21103 923421961 29850 931594794 3230 948294902 852781990 23842 860886853 986359363 881791496 33372 13...