This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |