Submission #911247

#TimeUsernameProblemLanguageResultExecution timeMemory
911247RockyBPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define f first #define s second #define pb push_back #define pp pop_back #define mp make_pair #define sz(x) (int)x.size() #define sqr(x) ((x) * 1ll * (x)) #define all(x) x.begin(), x.end() #define rep(i, l, r) for (int i = (l); i <= (r); i++) #define per(i, l, r) for (int i = (l); i >= (r); i--) #define Kazakhstan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0); #define nl '\n' #define ioi exit(0); typedef long long ll; typedef long double ld; typedef unsigned long long ull; const int N = (int)5e5 + 7; const int inf = (int)1e9 + 7; const int mod = (int)1e9 + 7; const ll linf = (ll)1e18 + 7; const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1}; const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1}; using namespace std; ll n; vector<int>ans, tmp, was; vector<vector<int>> g; void go(ll x) { if (!x) return; if (x & 1) { go(x / 2); ans.pb(sz(ans) ? *max_element(all(ans)) + 1 : 0); } else { go(x - 1); ans.pb(sz(ans) ? *min_element(all(ans)) - 1 : 0); } } void dfs(int v) { was[v] = 1; for (auto to : g[v]) if (!was[to]) dfs(to); tmp.pb(v); } void solve(ll n) { // cin >> n; ans.clear(); g.clear(); tmp.clear(); was.clear(); go(n-1); g.resize(sz(ans)); was.resize(sz(ans)); rep(i, 0, sz(ans) - 1) { // cerr << ans[i] << ' '; rep(j, i + 1, sz(ans) - 1) { if (ans[i] < ans[i]) { g[j].pb(i); } if (ans[i] > ans[j]) { g[i].pb(j); } } } // cerr << nl; per(i, sz(ans) - 1, 0) if (!was[i]) dfs(i); } vector<int> construct_permutation(ll n) { solve(n); // reverse(all(tmp)); vector<int> perm(sz(tmp)); rep(i, 0, sz(tmp) - 1) perm[tmp[i]] = i; return perm; // for (auto it : tmp) cout << it << ' '; } int main() { #ifdef wws freopen ("in.txt", "r", stdin); #endif for (auto it : construct_permutation(13)) cout << it << ' '; ioi }

Compilation message (stderr)

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