#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define N 2000000
int seg[N*4];
inline void up(int x,int l,int r,int hedef){
if(l>r||l<hedef||r>hedef)return;
if(l==r){seg[x]=1;return;}
int m=(l+r)/2;
up(x*2,l,m,hedef);up(x*2+1,m+1,r,hedef);
seg[x]=seg[x*2]+seg[x*2+1];
}
inline int qu(int x,int l,int r){
if(l>r)return 0;
if(l==r){seg[x]=1;return l;}
int m=(l+r)/2;
int cev;
if(seg[x*2]==seg[x*2+1]){
cev=qu(x*2,l,m);
}
else cev=qu(x*2+1,m+1,r);
seg[x]=seg[x*2]+seg[x*2+1];
return cev;
}
int main(){
lalala;
int n,k;cin>>n>>k;
for(int i=0;i<k-1;i++){
qu(1,1,(1<<n));
}
cout<<qu(1,1,(1<<n))<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
220 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
220 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
7 ms |
844 KB |
Output is correct |
9 |
Correct |
22 ms |
2380 KB |
Output is correct |
10 |
Correct |
50 ms |
8520 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
220 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
7 ms |
844 KB |
Output is correct |
9 |
Correct |
22 ms |
2380 KB |
Output is correct |
10 |
Correct |
50 ms |
8520 KB |
Output is correct |
11 |
Execution timed out |
1062 ms |
212 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |