제출 #955684

#제출 시각아이디문제언어결과실행 시간메모리
955684Otalp순열 (APIO22_perm)C++17
71.22 / 100
10 ms1372 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back vector<int> construct_permutation(ll k) { vector<int> ans; ll h = k - 1; vector<int> d; ll ls = -1; for(int i=60; i>=1; i--){ while(h >= (1ll << i) - 1){ d.pb(i); ls += i; h -= (1ll << i) - 1; } } if(h > 0) d.pb(1), ls ++; for(auto x: d){ int l=ls-x+1, r=ls; ls -= x; for(int i=l; i<=r; i++){ ans.pb(i); } } for(int i=0; i<d.size(); i++){ //cout<<d[i]<<' '; } //cout<<'\n'; for(int i=0; i<ans.size(); i++){ //cout<<ans[i]<<' '; } return ans; }

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

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