답안 #675706

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

using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n, k;
    cin >> n >> k;
    ll pos = 0, add = n;
    bool inv = false;
    
    for (int i = 0; i < n; i++) {
        add--;
        if (inv == false) {
            if ((k & (1 << i))) {
                inv = 1;
            } else {
                pos |= (1 << add);
            }
        } else {
            if ((k & (1 << i))) {
                pos |= (1 << add);
            } else {
                inv = 1;
            }
        }
    }

    ll mod = 1e9+7;
    cout << (pos+1) % mod << '\n';

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Incorrect 1 ms 280 KB Output isn't correct
12 Halted 0 ms 0 KB -