Submission #976230

#TimeUsernameProblemLanguageResultExecution timeMemory
976230rythm_of_knightPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int long long using namespace std; void fastio() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); } void construct_permutation(int k) { 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 <signed> ans; vector <signed> keyin; for (int i = 0; i < sz; i++) { vector <int> t; if (v[i] == 0) continue; while (--v[i]) { keyin.push_back(++cnt); } ans.push_back(++cnt); } reverse(keyin.begin(), keyin.end()); for (signed &u : keyin) ans.push_back(u); for (signed &i : ans) cout << i << ' '; cout << '\n'; } signed main() { fastio(); int q, k; cin >> q; while (q--) { cin >> k; construct_permutation(k); } }

Compilation message (stderr)

/usr/bin/ld: /tmp/cccIfIC1.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccPdLHUX.o:perm.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status