Submission #559865

# Submission time Handle Problem Language Result Execution time Memory
559865 2022-05-10T19:07:44 Z Stavab Rack (eJOI19_rack) C++14
40 / 100
1 ms 212 KB
#include <bits/stdc++.h>

using namespace std;

const int mod = 1000000007;
long long i, j, k;

void narrow (int lower, int upper)
{
    if (k % 2 == 0)
    {
        lower = (upper + lower) / 2 + 1;
        k /= 2;
    }
    else
    {
        upper = (upper + lower) / 2;
        k /= 2;
        k++;
    }
    
    i = lower;
    j = upper;
}

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

    i = 1;
    j = 1;
    for (int a = 1; a <= n; a++)
    {
        j = (j * 2) % mod;
    }

    while (j != i)
    {
        narrow(i, j);
    }

    cout << i;
    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 1 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 1 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 0 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 1 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 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -