Submission #975935

# Submission time Handle Problem Language Result Execution time Memory
975935 2024-05-06T03:37:08 Z Orifkhon Permutation (APIO22_perm) C++17
91.3333 / 100
1 ms 484 KB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
#include <perm.h>
using namespace std;

vector<int> construct_permutation(long long k) {
  int z = __lg(k);
  vector<int> p(z);
  iota(p.begin(), p.end(), 0);
  for (int i = z - 1; i >= 0; i--) {
    if ((k >> i) & 1) {
      p.insert(p.begin() + i, z++);
    }
  }
  return p;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 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 344 KB Output is correct
7 Correct 1 ms 484 KB Output is correct
8 Partially correct 1 ms 344 KB Partially correct
9 Correct 1 ms 348 KB Output is correct
10 Partially correct 1 ms 348 KB Partially correct
11 Partially correct 1 ms 348 KB Partially correct
12 Partially correct 1 ms 348 KB Partially correct
13 Partially correct 1 ms 348 KB Partially correct