제출 #638484

#제출 시각아이디문제언어결과실행 시간메모리
638484minhnhatnoe순열 (APIO22_perm)C++17
91.33 / 100
2 ms340 KiB
#include "perm.h" #include <bits/stdc++.h> typedef long long ll; using namespace std; vector<int> construct_permutation(long long k){ deque<long double> a; ll val = 63 - __builtin_clzll(k); for (ll i=0; i<val; i++){ a.push_back(i+1); } for (ll i=val-1; i>=0; i--){ if ((k & (1LL<<i)) == 0) continue; a.push_front(a[a.size() - i - 1] + 0.5); } // for (int i=0; i<a.size(); i++){ // cout << a[i] << " "; // } // cout << "\n"; deque<long double> b = a; sort(b.begin(), b.end()); vector<int> result(a.size()); for (int i=0; i<a.size(); i++){ result[i] = lower_bound(b.begin(), b.end(), a[i]) - b.begin() ; // cout << result[i] << " "; } // cout << endl; return result; } // signed main(){ // construct_permutation(0b11); // }

컴파일 시 표준 에러 (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::deque<long double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i=0; i<a.size(); i++){
      |                   ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...