답안 #615987

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
615987 2022-07-31T17:22:24 Z kideso Rack (eJOI19_rack) C++17
100 / 100
10 ms 8148 KB
#include <iostream>
#include <queue>

using namespace std;
using ll = long long;

const ll maxN = 1e6, P = 1e9 + 7;

vector<ll> powers(maxN + 1);
ll N, K, ans;

void precomp(){
    powers[0] = 1;
    for(ll i = 1; i <= maxN; ++i)
        powers[i] = (powers[i - 1] * 2) % P;

    return;
}

int main(){
    precomp();
    
    cin >> N >> K;
    ans = 0;

    while(N != 0){
        if(K % 2 == 0) (ans += powers[N - 1]) %= P;
        --N;
        (K += 1) /= 2;
    }

    if(K == 1) (ans += 1) %= P;
    cout << ans << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8020 KB Output is correct
2 Correct 10 ms 8020 KB Output is correct
3 Correct 9 ms 8020 KB Output is correct
4 Correct 8 ms 8020 KB Output is correct
5 Correct 8 ms 8148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8020 KB Output is correct
2 Correct 10 ms 8020 KB Output is correct
3 Correct 9 ms 8020 KB Output is correct
4 Correct 8 ms 8020 KB Output is correct
5 Correct 8 ms 8148 KB Output is correct
6 Correct 8 ms 8020 KB Output is correct
7 Correct 9 ms 8020 KB Output is correct
8 Correct 10 ms 8136 KB Output is correct
9 Correct 8 ms 8020 KB Output is correct
10 Correct 9 ms 8124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8020 KB Output is correct
2 Correct 10 ms 8020 KB Output is correct
3 Correct 9 ms 8020 KB Output is correct
4 Correct 8 ms 8020 KB Output is correct
5 Correct 8 ms 8148 KB Output is correct
6 Correct 8 ms 8020 KB Output is correct
7 Correct 9 ms 8020 KB Output is correct
8 Correct 10 ms 8136 KB Output is correct
9 Correct 8 ms 8020 KB Output is correct
10 Correct 9 ms 8124 KB Output is correct
11 Correct 10 ms 8020 KB Output is correct
12 Correct 9 ms 8132 KB Output is correct
13 Correct 10 ms 8020 KB Output is correct
14 Correct 10 ms 8140 KB Output is correct
15 Correct 10 ms 8020 KB Output is correct