Submission #704745

#TimeUsernameProblemLanguageResultExecution timeMemory
704745beaconmcPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") //#include "perm.h" typedef long long ll; #define FOR(i,x,y) for(ll i=x; i<y; i++) using namespace std; vector<int> perm(ll k, ll shi){ if (k==2){ return {(int)shi}; } ll imp = k; vector<ll> ops; deque<ll> sus; while (k>1){ bool flag = false; FOR(i,2,min((ll)1000, (ll)k)){ if (k%i==0){ ops.push_back(i); k /= i; flag = true; break; } } if (flag) continue; ops.push_back(1); k -= 1; } ll cur = shi; reverse(ops.begin(), ops.end()); for (auto&i : ops){ if (i==1) sus.push_front(cur++); else{ ll temp = 0; for (auto&j : perm(i, cur)){ temp++; sus.push_back(j); } cur += temp; } } vector<int> ans; for (auto&i : sus) ans.push_back(i); return ans; } vector<int> construct_permutation(long long k){ return perm(k, 0); } int main(){ vector<int> a = perm(1000000000000000000,0); for (auto&i : a) cout << i << " "; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> perm(ll, ll)':
perm.cpp:19:5: warning: unused variable 'imp' [-Wunused-variable]
   19 |  ll imp = k;
      |     ^~~
/usr/bin/ld: /tmp/ccSzTaRg.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccfSaSve.o:perm.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status