Submission #982326

#TimeUsernameProblemLanguageResultExecution timeMemory
982326nninPermutation (APIO22_perm)C++17
91.33 / 100
2 ms348 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; using ll = long long; vector<int> construct_permutation(long long k) { int g = __lg(k); vector<int> ans; int cur = 0; while(cur<g) { ans.push_back(cur++); } for(int i=g-1;i>=0;i--) { if(k & (1ll<<i)) { for(int j=0;j<ans.size();j++) if(ans[j]>=i) ans[j]++; ans.push_back(i); } } return ans; }

Compilation message (stderr)

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