제출 #731433

#제출 시각아이디문제언어결과실행 시간메모리
731433ogibogi2004순열 (APIO22_perm)C++17
71.22 / 100
13 ms1332 KiB
#include "perm.h" #include<bits/stdc++.h> #define ll long long using namespace std; vector<int> construct_permutation(long long k) { vector<int>ret; int sz=0; k--; while(k) { ll p=0; while((1ll<<p)-1<=k) { p++; } p--; ret.push_back(p); k-=(1ll<<p)-1; } for(int i=0;i<ret.size();i++)sz+=ret[i]; vector<int>ans; for(int i=0;i<ret.size();i++) { for(int j=1;j<=ret[i];j++) { ans.push_back(sz-ret[i]+j); } sz-=ret[i]; } for(int i=0;i<ans.size();i++)ans[i]--; //for(auto xd:ans)cout<<xd<<" "; //cout<<endl; return ans; }

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

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