# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
575916 | 2022-06-11T17:15:34 Z | SHZhang | Permutation (APIO22_perm) | C++17 | 3 ms | 356 KB |
#include "perm.h" using namespace std; #define ll long long vector<int> construct_permutation(ll k) { ll maxbit = 0; for (ll i = 62; i >= 0; i--) { if (k & (1LL << i)) { maxbit = i; break; } } vector<int> ops; for (ll i = maxbit - 1; i >= 0; i--) { ops.push_back(0); if (k & (1LL << i)) ops.push_back(1); } vector<int> ans; for (int i = 0; i < ops.size(); i++) { if (ops[i] == 0) { ans.push_back((int)ans.size()); } else { for (int j = 0; j < ans.size(); j++) ans[j]++; ans.push_back(0); } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Partially correct | 1 ms | 340 KB | Partially correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Partially correct | 2 ms | 340 KB | Partially correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Partially correct | 2 ms | 340 KB | Partially correct |
11 | Partially correct | 1 ms | 340 KB | Partially correct |
12 | Partially correct | 3 ms | 340 KB | Partially correct |
13 | Partially correct | 2 ms | 356 KB | Partially correct |