CSES - Datatähti 2017 alku - Results
Submission details
Task:Bittijono
Sender:Diapolo10
Submission time:2016-10-05 13:05:41 +0300
Language:Python3
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.06 s1details
#2--2details
#31.67 s3details

Code

#! python3
# CSES 2017: Tehtävä 2

import math

def gen(num):
    ## limit = num%2^x
    ## kysytään 4. arvoa (eli lista[7+1])
    ## 4==2^2
    ## 4%2^2==0
    ## x. juuri 4 % 2 == 0
    ## 4^(1/x) % 2 == 0
    
    a = num
    b = [0,1,1,0,1,0,0,1]
    #b = math.log(a, 10)
    while a>len(b):
        b += swapper(b)+b
    
    print(b[a-1])

def swapper(lst):
    """Take a list and swap 0 to 1 and 1 to 0"""
    switch = {0:1, 1:0}
    return [switch[i] for i in lst]

def main(): #TODO: Try generating list on the fly by input%pow
    nums = [0]
    for i in range(10):
        nums+=swapper(nums)
    for i in range(int(input())):
        feed = int(input())
        gen(feed)
        

if __name__ == "__main__":
    main()

Test details

Test 1

Group: 1

Verdict:

input
100
62
9
12
73
...

correct output
1
1
1
0
1
...

user output
1
1
1
1
1
...

Test 2

Group: 2

Verdict:

input
100000
565433
141881
120108
825392
...

correct output
1
1
0
0
1
...

user output
(empty)

Test 3

Group: 3

Verdict:

input
100000
374768524402011755
937067109466254318
389256426086302899
932585725667010169
...

correct output
0
1
1
1
1
...

user output
(empty)