# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
573159 | 2022-06-06T07:31:55 Z | Vanilla | Permutation (APIO22_perm) | C++17 | 3 ms | 340 KB |
#include "perm.h" #include <bits/stdc++.h> using namespace std; long long find (long long k) { for (long long i = 1; i < 63; i++){ if ((1ll << i) > k) return i-1; } } std::vector<int> construct_permutation(long long k) { vector <int> rs; long long pw [100] = {}; k-=2; int sp = 1000; pw[0] = sp - 1; rs.push_back(sp); int step = 1; while (k != 0) { int hg = min(int(find(k)), step); if (pw[hg] == 0) { pw[hg] = pw[hg - 1] + sp; } rs.push_back(pw[hg]--); k-=(1ll << hg); step++; } vector <int> v = rs; sort(v.begin(), v.end()); map <int, int> mp; for (int i = 0; i < v.size(); i++){ mp[v[i]] = i; } for (int &i: rs){ i = mp[i]; } return rs; } // int main (){ // construct_permutation(12); // }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 336 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 | 2 ms | 340 KB | Partially correct |
6 | Correct | 2 ms | 296 KB | Output is correct |
7 | Correct | 2 ms | 340 KB | Output is correct |
8 | Partially correct | 3 ms | 340 KB | Partially correct |
9 | Correct | 2 ms | 340 KB | Output is correct |
10 | Partially correct | 3 ms | 340 KB | Partially correct |
11 | Partially correct | 3 ms | 340 KB | Partially correct |
12 | Partially correct | 2 ms | 340 KB | Partially correct |
13 | Partially correct | 3 ms | 340 KB | Partially correct |