제출 #969660

#제출 시각아이디문제언어결과실행 시간메모리
969660anton순열 (APIO22_perm)C++17
71.22 / 100
10 ms1368 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; #define pii pair<int, int> #define ll long long const int MAX_N = 1e3; void add_k(ll k, int val, vector<int>& v){ if(k==0){ return; } if(k == 1LL){ v.push_back(val); return; } else{ int w= 1; ll m =2; while(2LL*m -1LL <= k){ m*=2LL; w++; } for(int i= 0; i<w; i++){ v.push_back(val-w+i+1); } add_k(k-(m-1), val-w, v); } } std::vector<int> construct_permutation(long long k) { vector<int> res; int reslen = 0; add_k(k-1, 0, res); int minv = 0; for(auto e: res){ minv = min(minv, e); } for(int& e: res){ e -= minv; } return res; }

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

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:34:6: warning: unused variable 'reslen' [-Wunused-variable]
   34 |  int reslen = 0;
      |      ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...