Submission #232196

# Submission time Handle Problem Language Result Execution time Memory
232196 2020-05-16T10:55:23 Z PanTkd Rack (eJOI19_rack) C++14
100 / 100
14 ms 8192 KB
//
//  main.cpp
//  Hanging Rack
//
//  Created by Panagiotis Hadjicostas on 16/05/2020.
//  Copyright © 2020 Panagiotis Hadjicostas. All rights reserved.
//

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
#define MOD ll(1e9+7)
ll din[1000001];
ll reverse1(ll num,ll n)
{
    ll b=0;
    for (ll i = n - 1; i >= 0&&num; i--) {
        if (num % 2 == 1) {
            b=(b+din[i])%MOD;
            //cout<<b<<endl;
        }
        num/=2;
    }
    return b;
}
int main() {
    
    ll n,k;cin>>n>>k;
    din[0]=1;
    for(ll i=1;i<1000001;i++){
        din[i]=(din[i-1]*2)%MOD;
    }
    //cout<<'h';
    //k--;
    cout<<(reverse1(k-1, n)+1)%MOD<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 13 ms 8192 KB Output is correct
2 Correct 13 ms 8192 KB Output is correct
3 Correct 12 ms 8192 KB Output is correct
4 Correct 12 ms 8192 KB Output is correct
5 Correct 13 ms 8192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 8192 KB Output is correct
2 Correct 13 ms 8192 KB Output is correct
3 Correct 12 ms 8192 KB Output is correct
4 Correct 12 ms 8192 KB Output is correct
5 Correct 13 ms 8192 KB Output is correct
6 Correct 12 ms 8192 KB Output is correct
7 Correct 12 ms 8192 KB Output is correct
8 Correct 12 ms 8192 KB Output is correct
9 Correct 12 ms 8192 KB Output is correct
10 Correct 12 ms 8192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 8192 KB Output is correct
2 Correct 13 ms 8192 KB Output is correct
3 Correct 12 ms 8192 KB Output is correct
4 Correct 12 ms 8192 KB Output is correct
5 Correct 13 ms 8192 KB Output is correct
6 Correct 12 ms 8192 KB Output is correct
7 Correct 12 ms 8192 KB Output is correct
8 Correct 12 ms 8192 KB Output is correct
9 Correct 12 ms 8192 KB Output is correct
10 Correct 12 ms 8192 KB Output is correct
11 Correct 12 ms 8192 KB Output is correct
12 Correct 12 ms 8192 KB Output is correct
13 Correct 14 ms 8192 KB Output is correct
14 Correct 13 ms 8192 KB Output is correct
15 Correct 12 ms 8192 KB Output is correct