제출 #982364

#제출 시각아이디문제언어결과실행 시간메모리
982364nnin순열 (APIO22_perm)C++17
100 / 100
2 ms360 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)) { if(i>0 && (k&(1ll<<(i-1))) && ans.size()>=2 && ans[ans.size()-2]>ans[ans.size()-1]) { i--; for(int j=0;j<ans.size();j++) if(ans[j]>=i) ans[j]++; ans.insert(ans.end()-2, i); } else { for(int j=0;j<ans.size();j++) if(ans[j]>=i) ans[j]++; ans.push_back(i); } } } return ans; }

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

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:18:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int j=0;j<ans.size();j++) if(ans[j]>=i) ans[j]++;
      |                 ~^~~~~~~~~~~
perm.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     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...