Submission #977303

#TimeUsernameProblemLanguageResultExecution timeMemory
977303alex_2008Permutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> #include <cmath> #include <queue> #include <set> using namespace std; typedef long long ll; vector <int> construct(ll k) { vector <int> ans; int mx_num = 0; int cnt = 1; vector <int> path; while (k > 1) { if (k % 2 == 1) path.push_back(1), k--; else path.push_back(2), k /= 2; } reverse(path.begin(), path.end()); for (auto it : path) { if (it == 1) ans.insert(ans.begin(), mx_num++); else ans.push_back(mx_num++); } return ans; } int main() { vector <int> v = construct(43); for (auto it : v) { cout << it << " "; } }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct(ll)':
perm.cpp:14:6: warning: unused variable 'cnt' [-Wunused-variable]
   14 |  int cnt = 1;
      |      ^~~
/usr/bin/ld: /tmp/ccc3SuZK.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccKoeCuK.o:perm.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccc3SuZK.o: in function `main':
grader.cpp:(.text.startup+0x240): undefined reference to `construct_permutation(long long)'
collect2: error: ld returned 1 exit status