Submission #621191

#TimeUsernameProblemLanguageResultExecution timeMemory
621191aworuePermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <perm.h> using ll = long long; //#define int ll using namespace std; #define sz(x) (int)(x).size() #define foru(i, l, r) for(int i = l; i <= r; i++) #define ford(i, l, r) for(int i = l; i >= r; i--) #define fi first #define se second #define mod 998244353 #define db(x) cerr << __LINE__ << " " << #x << " " << x << "\n" using vi = vector<ll>; using pi = pair<int, int>; const int N = 200005; const ll inf = 2e18; ll calc(vi v){ vector<ll> f(sz(v)); ll sum = 1; foru(i, 0, sz(v) - 1){ f[i] = 1; foru(j, 0, i - 1){ if(v[j] < v[i]) f[i] += f[j]; f[i] = min(f[i], inf); } sum += f[i]; sum = min(sum, inf); } return sum; } vi construct_permutation(ll k){ if(k == 1) return {}; if(k == 2) return {0}; if(k == 3) return {1, 0}; auto res = construct_permutation(k / 4); int s = sz(res); if(k % 4 == 0){ res.push_back(s); res.push_back(s + 1); return res; } if(k % 4 == 1){ res.push_back(s); res.push_back(s + 1); res.push_back(-1); for(auto &x : res) x++; return res; } if(k % 4 == 2){ res.push_back(s); res.push_back(-1); res.push_back(s + 1); for(auto &x : res) x++; return res; } auto z = res; res.push_back(s); res.push_back(s + 1); for(auto &x : res) if(x > 1) x++; res.push_back(2); if(calc(res) == k) return res; for(auto &x : z) x += 2; z.push_back(s + 2); z.push_back(1); z.push_back(s + 3); z.push_back(0); return z; } /*void solve(){ int q; cin >> q; while(q--){ int k; cin >> k; for(auto x : construct_permutation(k)){ cout << x << " "; } cout << "\n"; } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; // cin >> t; while(t--){ solve(); } }*/

Compilation message (stderr)

perm.cpp:35:4: error: ambiguating new declaration of 'vi construct_permutation(ll)'
   35 | vi construct_permutation(ll k){
      |    ^~~~~~~~~~~~~~~~~~~~~
In file included from perm.cpp:2:
perm.h:3:18: note: old declaration 'std::vector<int> construct_permutation(long long int)'
    3 | std::vector<int> construct_permutation(long long k);
      |                  ^~~~~~~~~~~~~~~~~~~~~
perm.cpp: In function 'vi construct_permutation(ll)':
perm.cpp:44:10: error: could not convert 'res' from 'vector<int>' to 'vector<long long int>'
   44 |   return res;
      |          ^~~
      |          |
      |          vector<int>
perm.cpp:51:10: error: could not convert 'res' from 'vector<int>' to 'vector<long long int>'
   51 |   return res;
      |          ^~~
      |          |
      |          vector<int>
perm.cpp:58:10: error: could not convert 'res' from 'vector<int>' to 'vector<long long int>'
   58 |   return res;
      |          ^~~
      |          |
      |          vector<int>
perm.cpp:65:10: error: could not convert 'res' from 'vector<int>' to 'vector<long long int>'
   65 |  if(calc(res) == k) return res;
      |          ^~~
      |          |
      |          vector<int>
perm.cpp:65:28: error: could not convert 'res' from 'vector<int>' to 'vector<long long int>'
   65 |  if(calc(res) == k) return res;
      |                            ^~~
      |                            |
      |                            vector<int>
perm.cpp:71:9: error: could not convert 'z' from 'vector<int>' to 'vector<long long int>'
   71 |  return z;
      |         ^
      |         |
      |         vector<int>