제출 #745529

#제출 시각아이디문제언어결과실행 시간메모리
745529mohav48173순열 (APIO22_perm)C++17
91.33 / 100
2 ms468 KiB
#include<bits/stdc++.h> #include "perm.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++) { if(i==0)continue; ans.push_back(cur++); if(bits[i])ans.push_front(cur++); } vector<int>anss; for(int i:ans)anss.push_back(i); return anss; }

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

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