Submission #462552

# Submission time Handle Problem Language Result Execution time Memory
462552 2021-08-10T18:06:05 Z liza Rack (eJOI19_rack) C++14
100 / 100
118 ms 272 KB
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    long long  n;
    long long k;
    //n2;
    long long modul = 1e9 + 7;
    cin >> n >> k;
    k--;
    //n2 = pow(2, n);
    long long a = 1;
    long long b = 1, p2s = n - 1;//, b = p2s;
    /*if (k == 1)
    {
        cout << 1;
        return 0;
    }
    if (k == 2)
    {
        cout << 1 + n2;
        return 0;
    }*/
    while (p2s >= 0)
    {
        if (k % 2 == 1)
        {
            b = 1;
            for (long long i = 0; i < p2s; i++)
            {
                b = b * 2;
                b %= modul;
            }
            a = (a + b)% modul;
        }
        k = k / 2;
        p2s--;
    }
    cout << a;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 9 ms 204 KB Output is correct
15 Correct 118 ms 272 KB Output is correct