Submission #631184

# Submission time Handle Problem Language Result Execution time Memory
631184 2022-08-17T18:49:59 Z smartmonky XORanges (eJOI19_xoranges) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
main(){
	int n,k;
	cin >>n >>k;
	int x=(1 << n);
	vector <int> v(x*2);
	v[1]=1;
	ans.pb(1);
	v[2]=x/2+1;
	ans.pb(v[2]);
	int cnt=2;
	for(int i=x/4;i>=1;i/=2){
		for(int j=1;j<=cnt;j++){
			v[cnt+j]=v[j]+i;
			ans.pb(v[j]+i);
		}
		cnt*=2;
	}
	//for(int i=1;i<=x;i++)
	//	cout<<v[i] <<" ";
	cout<<ans[k-1];
}

Compilation message

xoranges.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
xoranges.cpp: In function 'int main()':
xoranges.cpp:11:2: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |  ans.pb(1);
      |  ^~~
      |  abs