Submission #672151

# Submission time Handle Problem Language Result Execution time Memory
672151 2022-12-14T20:48:31 Z Stavab Rack (eJOI19_rack) C++14
100 / 100
100 ms 296 KB
#include <iostream>

using namespace std;

long long pow(int n)
{
    long long t = 1;
    for(int i = 1; i <= n; i++)
    {
        t *= 2;
        t %= 1000000007;
    }
    return t;
}

int main()
{
    long long n, k;
    cin >> n >> k;
    
    k = k - 1;
    long long ans = 0;
    for(int i = 1; i <= n; i++)
    {
        if(k % 2 == 1)
        {
            ans += pow(n - i);
            ans %= 1000000007;
        }
        
        k /= 2;
    }
    
    ans = ans + 1;
    ans %= 1000000007;
    
    cout << ans << '\n';
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 8 ms 296 KB Output is correct
15 Correct 100 ms 280 KB Output is correct