Submission #638567

#TimeUsernameProblemLanguageResultExecution timeMemory
638567bachhoangxuanPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; #define int long long vector<int> construct_permutation(int k){ if(k==1) return {}; else if(k==2) return {0}; else if(k==3) return {1,0}; vector<int> res=construct_permutation(k>>2); int s=(int)res.size(); if(k%4==0){res.push_back(s);res.push_back(s+1);} else if(k%4==1){res.push_back(s);res.push_back(s+1);res.push_back(-1);for(int &x:res) x++;} else if(k%4==2){res.push_back(s);res.push_back(-1);res.push_back(s+1);for(int &x:res) x++;} if(k%4!=3) return res; if((k>>2)<=2 || (k>>2)%4==0){ res.push_back(s);res.push_back(-1);res.push_back(s+1);res.push_back(-2); for(int &x:res) x+=2; } else{ res.push_back(s);res.push_back(s+1); for(int &x:res){if(x>=2) x++;} res.push_back(2); } return res; } /* signed main(){ int n;cin >> n; vector<int> res=construct_permutation(n); for(int v:res) cout << v << ' '; } */

Compilation message (stderr)

perm.cpp:6:13: error: ambiguating new declaration of 'std::vector<long long int> construct_permutation(long long int)'
    6 | vector<int> construct_permutation(int k){
      |             ^~~~~~~~~~~~~~~~~~~~~
In file included from perm.cpp:1:
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 'std::vector<long long int> construct_permutation(long long int)':
perm.cpp:10:42: error: conversion from 'vector<int>' to non-scalar type 'vector<long long int>' requested
   10 |     vector<int> res=construct_permutation(k>>2);
      |                     ~~~~~~~~~~~~~~~~~~~~~^~~~~~