제출 #953651

#제출 시각아이디문제언어결과실행 시간메모리
953651De3b0o순열 (APIO22_perm)C++17
0 / 100
0 ms348 KiB
#include "perm.h" #include<bits/stdc++.h> #define ll long long #define F first #define S second #define in insert #define pb push_back #define ppb pop_back() #define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define cans cout << ans << "\n"; #define yes cout << "Yes" << "\n"; #define no cout << "No" << "\n"; #define pll pair<ll,ll> #define lin cout << "\n"; #define sqr 340 #define mod 1000000007 #define mid ((l+r)/2) //#define lc (2*n) //#define rc (2*n+1) using namespace std; std::vector<int> construct_permutation(long long k) { vector<pll> v; ll p = 0; ll i = 0; k--; while(k>0) { if(k<i-p+1) { v.pb({p,i-1}); p=i; continue; } if(k==i-p+1) { v.pb({p,i}); p=i; k=0; continue; } k-=(i-p+1); i++; } vector<int> ans(p+1,0); ll x = 0; for(int i = v.size()-1 ; i>=0 ; i--) { for(int j = v[i].F ; v[i].S >=j ; j++) { ans[j]=x; x++; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...