#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
int tree[3000000], p = 0;
void search(int l, int r, int k)
{
if (l == r)
{
p = l + 1;
tree[k] = 1;
}
else
{
int mid = (l + r) / 2;
if (tree[k * 2] == tree[k * 2 + 1])
{
search(l, mid, k * 2);
}
else
{
search(mid + 1, r, k * 2 + 1);
}
tree[k] = tree[k * 2] + tree[k * 2 + 1];
}
}
int main()
{
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int n, m;
cin >> n >> m;
int d = (1 << n);
for (int i = 0; i < m; i++)
{
search(0, d - 1, 1);
}
cout << p;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
8 ms |
836 KB |
Output is correct |
9 |
Correct |
27 ms |
2384 KB |
Output is correct |
10 |
Correct |
55 ms |
8512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
8 ms |
836 KB |
Output is correct |
9 |
Correct |
27 ms |
2384 KB |
Output is correct |
10 |
Correct |
55 ms |
8512 KB |
Output is correct |
11 |
Execution timed out |
1089 ms |
212 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |