#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#define pb push_back
#define F first
#define S second
#define ld long double
#define all(a) a.begin(),a.end()
#define pii pair <int,int>
#define ll long long
#define sz(v) (int)v.size()
#define rep(i , a , b) for(int i=a;i <= (b);i++)
#define per(i , a , b) for(int i=a;i >= (b);i--)
#define deb(x) cout <<#x << " : " << x << "\n" ;
using namespace std ;
const int maxn = 2e6 + 10 , maxq = 32, inf = 1e9+10 , lg = 19 ,sq = 1000 ,mod = 998244353 ;
ll dp[maxn] ;
vector<int> construct_permutation(ll k){
k -- ;
vector <int> ans ;
int c= 0 ;
while(k){
ll t = 1;
int id =sz(ans) ;
rep(i ,0 , sz(ans)-1){
if(t+dp[ans[i]] <= k){
t += dp[ans[i]] ;
}else{
id = i ;
break;
}
}
ans.pb(0);
per(i , sz(ans)-2 , id){
swap(ans[i] , ans[i+1]) ;
}
k-=t;
dp[c] =t ;
ans[id] = c ;
c++;
}
return ans ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Partially correct |
2 ms |
348 KB |
Partially correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Partially correct |
2 ms |
348 KB |
Partially correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Partially correct |
2 ms |
592 KB |
Partially correct |
11 |
Partially correct |
2 ms |
348 KB |
Partially correct |
12 |
Partially correct |
1 ms |
348 KB |
Partially correct |
13 |
Partially correct |
2 ms |
348 KB |
Partially correct |