CSES - Putka Open 2015 – 6/6 - Results
Submission details
Task:Bittilista
Sender:
Submission time:2015-12-06 15:55:42 +0200
Language:Python3
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.08 s1details
#20.08 s1details
#3ACCEPTED0.08 s1details
#40.09 s1details
#5ACCEPTED0.08 s1details
#60.07 s2details
#7ACCEPTED0.09 s2details
#80.10 s2details
#90.09 s2details
#100.08 s2details
#11ACCEPTED0.07 s3details
#12ACCEPTED0.09 s3details
#13ACCEPTED0.09 s3details
#140.09 s3details
#15ACCEPTED0.08 s3details

Code

#!/usr/bin/env python3

# jono alkaa samalla bitillä kuin päättyy, joten jonossa on
# ensin 2^(n-2) kpl 0..0 -ratkaisuja, sitten saman verran 1..1 -ratkaisuja

def main():
    n, k = [int(x) for x in input().split()]
    nollaratkaisuja = 2 ** (n - 2)
    if k > nollaratkaisuja:
        k -= nollaratkaisuja
        print('1' + bin(k - 1)[2:] + '1')
    else:
        print('0' + bin(k - 1)[2:] + '0')

if __name__ == '__main__':
    main()

Test details

Test 1

Group: 1

Verdict:

input
10 54

correct output
0001101010

user output
01101010

Test 2

Group: 1

Verdict:

input
10 302

correct output
1001011011

user output
11011011

Test 3

Group: 1

Verdict: ACCEPTED

input
10 241

correct output
0111100000

user output
0111100000

Test 4

Group: 1

Verdict:

input
10 382

correct output
1011111011

user output
111111011

Test 5

Group: 1

Verdict: ACCEPTED

input
10 138

correct output
0100010010

user output
0100010010

Test 6

Group: 2

Verdict:

input
20 131002

correct output
00111111111101110010

user output
0111111111101110010

Test 7

Group: 2

Verdict: ACCEPTED

input
20 441567

correct output
11010111100110111101

user output
11010111100110111101

Test 8

Group: 2

Verdict:

input
20 109770

correct output
00110101100110010010

user output
0110101100110010010

Test 9

Group: 2

Verdict:

input
20 327308

correct output
10011111110100010111

user output
111111110100010111

Test 10

Group: 2

Verdict:

input
20 302918

correct output
10010011111010001011

user output
110011111010001011

Test 11

Group: 3

Verdict: ACCEPTED

input
50 216967103451763

correct output
011000101010101001001011100100...

user output
011000101010101001001011100100...

Test 12

Group: 3

Verdict: ACCEPTED

input
50 236618662270629

correct output
011010111001101000001001101001...

user output
011010111001101000001001101001...

Test 13

Group: 3

Verdict: ACCEPTED

input
50 426560943304480

correct output
110000011111101000111010110000...

user output
110000011111101000111010110000...

Test 14

Group: 3

Verdict:

input
50 294553802415801

correct output
100001011111001010010011011000...

user output
110111110010100100110110000101...

Test 15

Group: 3

Verdict: ACCEPTED

input
50 502225394100883

correct output
111001000110001010111011000110...

user output
111001000110001010111011000110...