제출 #703514

#제출 시각아이디문제언어결과실행 시간메모리
703514khanhhdz191순열 (APIO22_perm)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <perm.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define ff first #define ss second #define pb push_back #define endl "\n" /// ko dc giai nhat chat me tay di /// khanhdzvcl const ll inf=2e18; ll C(vector<ll> v) { ll m=(ll)v.size(); vector<ll> f(m); ll sum=1; for (ll i=0; i<m; i++) { f[i]=1; for (ll j=0; j<i; j++) { if (v[j]<v[i]) f[i]+=f[j]; f[i]=min(f[i],inf); } sum+=f[i]; sum=min(sum,inf); } return sum; } vector<ll> construct_permutation(ll k) { if (k==1) return {}; if (k==2) return {0}; if (k==3) return {1,0}; // if (k==4) // return {0,1}; vector<ll> ans=construct_permutation(k/4); ll n=(ll)ans.size(); if (k%4==0) { ans.pb(n); // ans.pb(0); ans.pb(n+1); // for (auto &p:ans) p++; return ans; } if (k%4==1) { ans.pb(n); ans.pb(n+1); ans.pb(-1); for (auto &p:ans) p++; return ans; } if (k%4==2) { ans.pb(n); ans.pb(-1); ans.pb(n+1); for (auto &p:ans) p++; return ans; } auto man=ans; ans.pb(n); ans.pb(n+1); for (ll i=0; i<(ll)ans.size(); i++) { if (ans[i]>1) ans[i]++; } ans.pb(2); if (C(ans)==k) return ans; for (auto &p:man) p+=2; man.pb(n+2); man.pb(1); man.pb(n+3); man.pb(0); return man; } /* void tc() { ll k; cin>> k; auto v=construct_permutation(k); for (auto &p:v) cout<< p<<' '; } int main() { // freopen("bi.txt","r",stdin); // freopen("out.txt","w",stdout); ios_base::sync_with_stdio(0); cin.tie(nullptr); ll t=1; cin>> t; while (t--) { tc(); cout<< endl; } } */

컴파일 시 표준 에러 (stderr) 메시지

perm.cpp:35:12: error: ambiguating new declaration of 'std::vector<long long int> construct_permutation(long long int)'
   35 | vector<ll> 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 'std::vector<long long int> construct_permutation(long long int)':
perm.cpp:45:41: error: conversion from 'vector<int>' to non-scalar type 'vector<long long int>' requested
   45 |     vector<ll> ans=construct_permutation(k/4);
      |                    ~~~~~~~~~~~~~~~~~~~~~^~~~~