답안 #778394

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
778394 2023-07-10T09:07:34 Z andrei_iorgulescu Rack (eJOI19_rack) C++14
100 / 100
8 ms 7848 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

int modulo = 1e9 + 7;
int p2[1000005];

int f(int n,int k)
{
    if (n == 0)
        return 1;
    if (k % 2 == 1)
        return f(n - 1,k / 2 + 1);
    else
        return (f(n - 1,k / 2) + p2[n - 1]) % modulo;
}

signed main()
{
    int n,k;
    cin >> n >> k;
    p2[0] = 1;
    for (int i = 1; i <= n; i++)
        p2[i] = 2 * p2[i - 1] % modulo;
    cout << f(n,k);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 688 KB Output is correct
15 Correct 8 ms 7848 KB Output is correct