Submission #976116

#TimeUsernameProblemLanguageResultExecution timeMemory
976116rythm_of_knightPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include "perm.h" #include <vector> #include <algorithm> std::vector<int> construct_permutation(long long k) { #define int long long using namespace std; int temp = --k; vector <int> v; while (temp) { v.push_back(temp & 1); temp >>= 1; } int sz = v.size(); for (int i = 0; i < sz; i++) { while (i > 0 && v[i - 1] == 0 && v[i] > 0) { v[i - 1] += 2; v[i]--; i--; } } int cnt = -1; vector <int> ans; for (int i = 0; i < sz; i++) { vector <int> t; while (v[i]--) { t.push_back(++cnt); } reverse(t.begin(), t.end()); for (int &u : t) { ans.push_back(u); } } return ans; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:33:12: error: could not convert 'ans' from 'vector<long long int>' to 'vector<int>'
   33 |     return ans;
      |            ^~~
      |            |
      |            vector<long long int>