제출 #573687

#제출 시각아이디문제언어결과실행 시간메모리
573687Jomnoi순열 (APIO22_perm)C++17
91.33 / 100
3 ms340 KiB
#include <bits/stdc++.h> #include "perm.h" using namespace std; vector <int> construct_permutation(long long k) { deque <int> p; vector <int> binary; while(k > 0) { binary.push_back(k % 2); k /= 2; } reverse(binary.begin(), binary.end()); int n = 0; for(int i = 1; i < binary.size(); i++) { p.push_back(n++); if(binary[i] == 1) { p.push_front(n++); } } return vector <int> (p.begin(), p.end()); }

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

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