제출 #1040725

#제출 시각아이디문제언어결과실행 시간메모리
1040725MarwenElarbi순열 (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 = 63; i >= 0; --i) { if(k>=(1ll<<i)){ k-=(1ll<<i); tab.pb(i+1); cnt+=i+1; } } 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:19:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |  for (int i = 0; i < tab.size(); ++i)
      |                  ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...