제출 #983288

#제출 시각아이디문제언어결과실행 시간메모리
983288Sir_Ahmed_Imran순열 (APIO22_perm)C++17
91.33 / 100
1 ms348 KiB
///~~~LOTA~~~/// #include "perm.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define append push_back #define add insert #define nl '\n' #define ff first #define ss second #define pii pair<int,int> #define pll pair<ll,ll> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define terminator main #define N 60 ll pwr[N]; vector<int> construct_permutation(ll n){ int m; pwr[0]=1; vector<int> u,v; for(ll i=1;i<N;i++) pwr[i]=pwr[i-1]*2LL; for(int i=59;i>0;i--){ if(n<pwr[i]) continue; n-=pwr[i]; if(v.empty()){ m=i; for(int j=0;j<i;j++) v.append(j); continue; } u.append(v[m-i]); for(int j=m-i;j<m;j++) v[j]++; } if(n) u.append(v.back()+1); reverse(all(u)); for(auto& i:v) u.append(i); return u; }

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

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:20:9: warning: 'm' may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |     int m;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...