제출 #1117631

#제출 시각아이디문제언어결과실행 시간메모리
1117631erering순열 (APIO22_perm)C++17
0 / 100
1 ms336 KiB
#include <bits/stdc++.h> #include "perm.h" using namespace std; #define endl '\n' #define pb push_back bool flag=1; vector<int> construct_permutation(long long k) { long long cnt=-1,x=1,r=1; if(flag)r=0; flag=0; while (x-r <= k) { x *= 2; cnt++; } x-=r; x /= 2; vector<int> vec; for (int i = 0; i < cnt; i++)vec.pb(i); k -= x; vector<int> v; if(k>0)v=construct_permutation(k); for(int i=0;i<v.size();i++)v[i]+=vec.size(); for(int i=0;i<vec.size();i++)v.pb(vec[i]); return v; } /*signed main() { vector<int> v=construct_permutation(12); cout<<endl; for(auto i:v)cout<<i<<' '; }*/

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

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