제출 #911301

#제출 시각아이디문제언어결과실행 시간메모리
911301hjroh0315순열 (APIO22_perm)C++17
91.33 / 100
2 ms356 KiB
#include"perm.h" #include<bits/stdc++.h> using namespace std; std::vector<int>construct_permutation(long long k) { vector<int>ans; auto f=k;int last=-1; for(int i=0;i<62;i++) { if(f>0) { if(f&1)f--; if(f>0)ans.push_back(i); last=i; f>>=1; } } last--; while(last>=0) { if(k>>last&1) { for(int i=0;i<size(ans);i++) { if(ans[i]>=last)ans[i]++; } ans.push_back(last); } last--; } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:23:26: 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<size(ans);i++)
      |                         ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...