Submission #745527

#TimeUsernameProblemLanguageResultExecution timeMemory
745527mohav48173Permutation (APIO22_perm)C++17
0 / 100
0 ms212 KiB
#include<bits/stdc++.h> #include "perm.h" using namespace std; vector<int> construct_permutation(long long k) { deque<int>ans; vector<bool>bits; while(k>0) { if(k%2)bits.push_back(1); else bits.push_back(0); k/=2; } reverse(bits.begin(),bits.end()); int cur=0; for(int i=0;i<bits.size();i++) { ans.push_back(cur++); if(bits[i])ans.push_front(cur++); } vector<int>anss; for(int i:ans)anss.push_back(i); return anss; }

Compilation message (stderr)

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