# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
575237 | 2022-06-10T03:40:29 Z | AJ00 | 순열 (APIO22_perm) | C++17 | 1 ms | 212 KB |
#include <bits/stdc++.h> #include "perm.h" using namespace std; int n; const int MOD = 1000000007; vector<int> construct_permutation(long long int k){ vector<int> ans,op; ans.push_back(0); if (k == 2){ return ans; } // cerr << dp[k] << "\n"; long long int cur = k; while (cur != 2){ if (cur%2==0){ op.push_back(2); cur = (cur/2); } else { op.push_back(1); cur--; } } int maxm = 0,minm=0; for (int e: op){ if (e == 2){ ++maxm; ans.push_back(maxm); } else { --minm; ans.push_back(minm); } } for (int i = 0; i < ans.size(); i++){ ans[i] += abs(minm); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |