Submission #1083815

#TimeUsernameProblemLanguageResultExecution timeMemory
1083815alexander707070Permutation (APIO22_perm)C++17
0 / 100
1 ms344 KiB
#include<bits/stdc++.h> #define MAXN 200007 using namespace std; int num; deque<int> perm; vector<int> ans,w; void mult(){ perm.push_back(num); num++; } void add(){ perm.push_front(num); num++; } vector<int> construct_permutation(long long k){ bool fr=false; for(int i=62;i>=0;i--){ if((1LL<<i)>k)continue; if(((1LL<<i)&k)>0 and fr){ add(); }else if(((1LL<<i)&k)>0)fr=true; if(i>0)mult(); } for(int i=0;i<perm.size();i++){ ans.push_back(perm[i]); } return ans; } /*int main(){ w=construct_permutation(5); for(int i:w)cout<<i<<" "; }*/

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i=0;i<perm.size();i++){
      |                 ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...