Submission #911395

# Submission time Handle Problem Language Result Execution time Memory
911395 2024-01-18T21:04:27 Z nullchilly Permutation (APIO22_perm) C++17
91.3333 / 100
2 ms 348 KB
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> construct_permutation(long long k)
{
  int m = 64 - __builtin_clzll(k);
  vector<int> zero(m + 1);
	int pad = 0;
  for (int j = 0; j <= m; j++) {
    if (k & (1ll << j)) {
      zero[m - j - 1] = ++pad;
    }
  }
  vector<int> ans;
  for (int i = 1; i < m; i++) {
    ans.push_back(i + pad - 2);
    if (zero[i]) ans.push_back(zero[i] - 1);
  }
  return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Partially correct 1 ms 348 KB Partially correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Partially correct 1 ms 348 KB Partially correct
9 Correct 2 ms 348 KB Output is correct
10 Partially correct 2 ms 348 KB Partially correct
11 Partially correct 1 ms 348 KB Partially correct
12 Partially correct 2 ms 344 KB Partially correct
13 Partially correct 1 ms 348 KB Partially correct