답안 #1005675

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1005675 2024-06-22T18:18:00 Z vjudge1 Rack (eJOI19_rack) C++17
0 / 100
74 ms 102400 KB
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define pii pair<int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>
#define vl vector<ll>
#define vvl vector<vl>
#define vvi vector<vi>
#define pvi vector<pii>
#define vpvii vector<vpvii>
#define f first
#define s second
#define oo 1000000001
#define eb emplace_back
#define pb push_back
#define mpr make_pair
#define size(v) (int)v.size()
#define ln '\n'
#define ull unsigned long long
#define ll long long
#define all(v) v.begin(), v.end()
#define iospeed ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//using namespace __gnu_pbds;
//template <typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename T>
void show(vector<T> &v) {
    for (T i : v) {
        cout << i << ' ';
    }
    cout << ln;
}

const int mod = 1e9 + 7;
int solve(int n, ll k) {
    if (k == 1) return 0;
    if (n > 60 || k >= (1ll << (n - 1))) return (solve(n - 1, k) << 1) % mod;
    else return ((solve(n - 1, k - (1ll << (n - 1))) << 1) + 1) % mod;
}

void solve() {
    int n;
    ll k;
    cin >> n >> k;
    cout << (solve(n, k) + 1) % mod << ln;
}

int main() {
    iospeed;
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 74 ms 102400 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 74 ms 102400 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 74 ms 102400 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -