제출 #623812

#제출 시각아이디문제언어결과실행 시간메모리
623812iomoon191Permutation (APIO22_perm)C++17
컴파일 에러
0 ms0 KiB
#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<int>; using pi = pair<int, int>; const ll N = 200005; const ll inf = 1e18; vi construct_permutation(int k){ if(k == 1) return {}; if(k == 2) return {0}; if(k == 3) return {1, 0}; vi d = construct_permutation(k >> 2); int s = sz(d); if(k % 4 == 0){ d.push_back(s); d.push_back(s + 1); return d; } if(k % 4 == 1){ d.push_back(s); d.push_back(s + 1); d.push_back(-1); for(auto i : d) i++; return d; } if(k % 4 == 2){ d.push_back(s); d.push_back(-1); d.push_back(s + 1); for(auto i : d) i++; return d; } if(k % 4 == 3){ vi _d = d; d.push_back(s); d.push_back(s + 1); for(auto i : d) if(i > 1) i++; d.push_back(2); vi f(sz(d)); int sum = 1; foru(i, 0, sz(d) - 1){ f[i] = 1; foru(j, 0, i - 1){ if(d[j] < d[i]) f[i] += f[j]; f[i] = min(f[i], inf); } sum += f[i]; sum = min(sum, inf); } if(sum == k) return d; for(auto i : _d) i += 2; _d.push_back(s + 2); _d.push_back(1); _d.push_back(s + 3); _d.push_back(0); return _d; } }

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

perm.cpp:20:4: error: ambiguating new declaration of 'vi construct_permutation(ll)'
   20 | vi 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 'vi construct_permutation(ll)':
perm.cpp:24:30: error: conversion from 'vector<int>' to non-scalar type 'vector<long long int>' requested
   24 |  vi d = construct_permutation(k >> 2);
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
perm.cpp:24:37: warning: control reaches end of non-void function [-Wreturn-type]
   24 |  vi d = construct_permutation(k >> 2);
      |                                     ^