Submission #911275

#TimeUsernameProblemLanguageResultExecution timeMemory
911275tosivanmakPermutation (APIO22_perm)C++17
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long const ll Log=15; #define MAX 1e18 #define MOD 1000000007 typedef pair<ll,ll> LP; #define ld long double vector<ll>seq; ll cur=1; void bm(ll num){ if(num==0){ return; } if(num&1){ bm(num/2); seq.push_back(cur); cur++; } else{ bm((num-1)/2); seq.push_back(cur); seq.push_back(-cur); cur++; } } vector<int> construct_permutation(ll n){ bm(n-1); // cout<<seq.size()<<'\n'; vector<ll>seq2; for(auto& u: seq){ seq2.push_back(u); } sort(seq2.begin(),seq2.end()); vector<int>ans; for(auto& u: seq){ ans.push_back(lower_bound(seq2.begin(),seq2.end(),u)-seq2.begin()); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...