Submission #1050836

# Submission time Handle Problem Language Result Execution time Memory
1050836 2024-08-09T15:10:08 Z ThommyDB Rack (eJOI19_rack) C++17
40 / 100
1 ms 348 KB
#include<bits/stdc++.h>

using namespace std;

const int mod = 1e9+7;

int n, k;

signed main(){
    cin >> n >> k;

    vector<int> layers(n);

    layers[0]=1;
    signed long long s = 1;
    
    for(int i = 1; i < n; i++){
        s*=2;
        s%=mod;
        layers[i] = s;
    }

    long long ans = 1;
    for(int i = 0; i < n; i++){
        if(k%2==0){//right
            k /=2;
            ans += layers[n-i-1];
            ans%=mod;
        }
        else{//left
            k++;
            k /= 2;
        }
    }

    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -