답안 #675738

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
675738 2022-12-27T19:27:17 Z Alma Rack (eJOI19_rack) C++17
100 / 100
11 ms 7872 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
ll MOD = 1e9+7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    ll n, k;
    cin >> n >> k;
    ll pos = 1, add = n;

    vector<ll> powMOD(n+1);
    powMOD[0] = 1;
    for (int i = 1; i <= n; i++) {
        powMOD[i] = (powMOD[i-1] * 2) % MOD;
    }

    k--;
    for (int i = 0; i < n; i++) {
        add--;
        if (k % 2 == 1) {
            pos += powMOD[add];
            pos %= MOD;
        }
        k /= 2;
    }

    cout << pos << '\n';

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