답안 #675708

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

using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll mod = 1e9+7;
    ll n, k;
    cin >> n >> k;
    ll pos = 1, add = n;
    bool inv = false;

    for (int i = 0; i < min(n, 1LL * 63); i++) {
        add--;
        if (inv == false) {
            if ((k & (1 << i))) {
                inv = 1;
            } else {
                pos |= (1 << add);
                pos %= mod;
            }
        } else {
            if ((k & (1 << i))) {
                pos |= (1 << add);
                pos %= mod;
            } else {
                inv = 1;
            }
        }
    }

    cout << pos << '\n';

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -