답안 #464879

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
464879 2021-08-14T11:13:38 Z ewirlan Rack (eJOI19_rack) C++17
40 / 100
1 ms 256 KB
//RACK

#define _CTR_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
typedef long long ll;
template <typename T> T in()
{
    T x;
    std::cin >> x;
    return x;
}
constexpr ll mod = 1e9 + 7;
int main()
{
    std::cin.tie(nullptr); std::cout.tie(nullptr); std::ios_base::sync_with_stdio(0);
    ll n(in<ll>());
    ll K(in<ll>());
    ll p(0), k((1ll << std::min(62ll, n)) - 1), s, odp(0), pot(1);
    while (k > p)
    {
        s = (p + k + 1) / 2;
        if (K <= s)k = s - 1;
        else
        {
            p = s;
            odp = (odp + pot) % mod;
        }
        pot = (pot * 2) % mod;
    }
    std::cout << odp+1 << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 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 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 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 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Incorrect 0 ms 204 KB Output isn't correct
13 Halted 0 ms 0 KB -