# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
982838 | 2024-05-14T19:30:51 Z | vjudge1 | 순열 (APIO22_perm) | C++17 | 1 ms | 348 KB |
#include "perm.h" #include <bits/stdc++.h> #define rep(a,b,c) for(int a=b; a<c; a++) #define repr(a,b,c) for(int a=b-1; a>c-1; a--) #define repa(a,b) for(auto a:b) #define fi first #define se second #define pii pair<int, int> #define ll long long #define pb push_back using namespace std; string s; void solve(ll k){ if(k==1) return; if(k%3==0){ s+='0'; s+='2'; solve(k/3); }else if(k&1){ s+='1'; solve(k-1); }else{ s+='0'; solve(k/2); } } vector<int> construct_permutation(long long k){ vector<int> perm; s.clear(); solve(k); int x=0, y=s.size()-1; rep(i,0,s.size()){ if(s[i]=='1') perm.pb(x++); else perm.pb(y--); if(s[i]=='2') swap(perm[i],perm[i-1]); } ll z=1; reverse(perm.begin(),perm.end()); return perm; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 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 | 1 ms | 344 KB | Partially correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Partially correct | 1 ms | 348 KB | Partially correct |