제출 #1040742

#제출 시각아이디문제언어결과실행 시간메모리
1040742MarwenElarbi순열 (APIO22_perm)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "perm.h" using namespace std; #define pb push_back std::vector<int> construct_permutation(long long k) { k--; vector<int> tab; int cnt=0; for (int i = 62; i > 0; --i) { if(k>=(1LL<<i)-1){ k-=(1LL<<i)-1; tab.pb(i); cnt+=i; } } if(k==1){ tab.pb(1); cnt++; } vector<int> ans; for (int i = 0; i < tab.size(); ++i) { for (int j = cnt-tab[i]; j < cnt; ++j) { ans.pb(j); } cnt-=tab[i]; } return ans; }

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

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:23:20: 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 < tab.size(); ++i)
      |                  ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...