Submission #970697

# Submission time Handle Problem Language Result Execution time Memory
970697 2024-04-27T05:41:59 Z mannshah1211 Permutation (APIO22_perm) C++17
0 / 100
0 ms 344 KB
#include "perm.h"

using namespace std;

vector<int> construct_permutation(long long k) {
  if (k == 2) {
    return vector<int>(1, 0);
  }
  if (k % 2 == 1) {
    vector<int> bef = construct_permutation(k - 1);
    vector<int> ans = bef;
    for (int &v : ans) {
      v++;
    }
    ans.push_back(0);
  } else {
    vector<int> bef = construct_permutation(k / 2);
    vector<int> ans = bef;
    ans.push_back(ans.size());
  }
}

Compilation message

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:21:1: warning: control reaches end of non-void function [-Wreturn-type]
   21 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -