CSES - Putka Open 2015 – 6/6 - Results
Submission details
Task:Bittilista
Sender:
Submission time:2015-12-06 18:34:16 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.06 s1details
#20.05 s1details
#3ACCEPTED0.06 s1details
#40.05 s1details
#5ACCEPTED0.06 s1details
#6ACCEPTED0.05 s2details
#70.06 s2details
#8ACCEPTED0.04 s2details
#90.06 s2details
#100.06 s2details
#11ACCEPTED0.05 s3details
#12ACCEPTED0.06 s3details
#130.05 s3details
#140.05 s3details
#150.05 s3details

Code

#include <iostream>
using namespace std;
typedef long long ll;
ll dp[51][2][51][51];
int main() {
    ll n,k;
    cin>>n>>k;
    dp[1][0][0][0] = 1;
    dp[1][1][0][0] = 1;
    for(int i = 2; i <= n; ++i) {
        for(int io = 0; io < n; ++io) {
            for(int oi = 0; oi < n; ++oi) {
                dp[i][1][io+1][oi] += dp[i-1][0][io][oi];
                dp[i][1][io][oi] += dp[i-1][1][io][oi];
                dp[i][0][io][oi+1] += dp[i-1][1][io][oi];
                dp[i][0][io][oi] += dp[i-1][0][io][oi];
            }
        }
    }
    for(int i = n; i >= 1; --i) {
        ll sum0 = 0;
        for(int j = 0; j < n; ++j) {
            sum0 += dp[i][0][j][j];
        }
        //cout<<sum0<<'\n';
        if(sum0 >= k) {
            cout<<0;
        }
        else {
            k -= sum0;
            cout<<1;
        }
    }
    cout<<'\n';

}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
10 54

correct output
0001101010

user output
0001101010

Test 2

Group: 1

Verdict:

input
10 302

correct output
1001011011

user output
1001011010

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
1011111010

Test 5

Group: 1

Verdict: ACCEPTED

input
10 138

correct output
0100010010

user output
0100010010

Test 6

Group: 2

Verdict: ACCEPTED

input
20 131002

correct output
00111111111101110010

user output
00111111111101110010

Test 7

Group: 2

Verdict:

input
20 441567

correct output
11010111100110111101

user output
11010111100110111100

Test 8

Group: 2

Verdict: ACCEPTED

input
20 109770

correct output
00110101100110010010

user output
00110101100110010010

Test 9

Group: 2

Verdict:

input
20 327308

correct output
10011111110100010111

user output
10011111110100010110

Test 10

Group: 2

Verdict:

input
20 302918

correct output
10010011111010001011

user output
10010011111010001010

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:

input
50 426560943304480

correct output
110000011111101000111010110000...

user output
110000011111101000111010110000...

Test 14

Group: 3

Verdict:

input
50 294553802415801

correct output
100001011111001010010011011000...

user output
100001011111001010010011011000...

Test 15

Group: 3

Verdict:

input
50 502225394100883

correct output
111001000110001010111011000110...

user output
111001000110001010111011000110...