답안 #453232

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
453232 2021-08-04T09:44:31 Z lukadupli Rack (eJOI19_rack) C++14
100 / 100
5 ms 204 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX = 1e6 + 5, MOD = 1e9 + 7;

int n, sol;
long long k;

bool binary[MAX];

int main()
{
    cin >> n >> k;
    k--;

    for(int i = 0; i < min(n, 64); i++){
        if(k & (1LL << i)) binary[n - i - 1] = 1;
    }

    int pow2 = 1;
    for(int i = 0; i < n; i++){
        if(binary[i]) sol = (sol + pow2) % MOD;
        pow2 = (pow2 * 2) % MOD;
    }

    cout << (sol + 1) % MOD;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 5 ms 204 KB Output is correct