제출 #962749

#제출 시각아이디문제언어결과실행 시간메모리
9627490npata순열 (APIO22_perm)C++17
91.33 / 100
2 ms348 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; #define vec vector #define ll long long std::vector<int> construct_permutation(ll k) { // cerr << "k: " << k << '\n'; vec<ll> bp(0); vec<int> ans(0); for(ll i = 0; i<64; i++) { if((((ll)1)<<i) & k) { bp.push_back(i); } } int lb = bp.back(); bp.pop_back(); // cerr << "lb : " << lb << '\n'; int cur = 0; int j = 0; vec<int> right(0); vec<int> left(0); for(int i = 0; i<lb; i++) { if(bp[j] == i) { right.push_back(cur); cur++; j++; } left.push_back(cur); cur++; } reverse(right.begin(), right.end()); for(int i = 0; i<left.size(); i++) ans.push_back(left[i]); for(int i = 0; i<right.size(); i++) ans.push_back(right[i]); return ans; }

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

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