Submission #1113785

#TimeUsernameProblemLanguageResultExecution timeMemory
1113785PieArmyPermutation (APIO22_perm)C++17
0 / 100
1 ms336 KiB
typedef long long ll;
ll pie(ll army){return (1ll<<army);}
#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define endl '\n'
#define mid ((left+right)>>1)
const ll inf=2000000000000000005;
const int sonsuz=2000000005;
using namespace std;
ll fpow(ll x,ll y,ll m=0){if(y<0){cout<<"powError";return -1;}if(m)x%=m;ll res=1;while(y>0){if(y&1)res*=x;x*=x;if(m){x%=m;res%=m;}y>>=1;}return res;}

vector<int> construct_permutation(ll k){
	vector<int>res;
	int a=0,b=0,mx=0;
	for(int i=0;i<60;i++){
		if(pie(i)&k){
			a++;
			mx=i;
		}
	}
	b=a--;
	for(int i=mx;i>=0;i--){
		if(pie(i)&k){
			res.pb(a--);
		}
		else{
			res.pb(b++);
		}
	}
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...