Submission #982727

#TimeUsernameProblemLanguageResultExecution timeMemory
982727vjudge1Permutation (APIO22_perm)C++17
10 / 100
1 ms428 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; vector<int>construct_permutation(long long k){ vector<int>b,r,sol(150,0); for(int i=0;k;i++){ if(k&1)b.push_back(i); k/=2; } for(int i=0;i<b.back();i++){ r.push_back(i*2+1); sol[i*2+1]=1; } b.pop_back(); while(!b.empty()){ r.push_back(b.back()*2); sol[b.back()*2]=1; b.pop_back(); } for(int i=0,p=0;i<40;i++) if(sol[i]==1)sol[i]=p,p++; for(int i=0;i<r.size();i++){ r[i]=sol[r[i]]; } return r; }

Compilation message (stderr)

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