Submission #745526

#TimeUsernameProblemLanguageResultExecution timeMemory
745526mohav48173Permutation (APIO22_perm)C++17
0 / 100
1 ms212 KiB
#include<bits/stdc++.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:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0;i<bits.size();i++) {
      |                 ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...