Submission #744849

#TimeUsernameProblemLanguageResultExecution timeMemory
744849merlynnPermutation (APIO22_perm)C++17
91.33 / 100
2 ms344 KiB
#include <bits/stdc++.h> using namespace std; vector<int32_t> construct_permutation(long long k) { string bn=""; while(k) { bn+=k%2+'0'; k/=2; } reverse(bn.begin(),bn.end()); vector<int32_t> ret; int cur=0; for(int i=1;i<bn.size();i++) { ret.push_back(cur++); if(bn[i]=='1') ret.insert(ret.begin(),cur++); } return ret; }

Compilation message (stderr)

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