제출 #657789

#제출 시각아이디문제언어결과실행 시간메모리
657789iomoon191순열 (APIO22_perm)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "perm.h" using namespace std; typedef long long ll; typedef pair<ll,ll> pl; #define endl "\n" #define ff first #define ss second #define pb push_back #define all(a) (a).begin(),(a).end() const int N=1e6+5; //const ll mod=1e9+7; mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count()); vector<int> sub_1(ll k) { vector<ll> vt(k-1); iota(all(vt),0ll); reverse(all(vt)); return vt; } vector<int> construct_permutation(ll k) { // if (k<=90) // return sub_1(k); if (k==1) return {}; if (k==2) return {0}; if (k==3) return {1,0}; vector<int> vt=construct_permutation((ll)(k/4)); ll sz=(ll)vt.size(); if (k%4==0) { vt.pb(sz); vt.pb(sz+1); return vt; } if (k%4==1) { vt.pb(sz); vt.pb(sz+1); vt.pb(-1ll); for (auto &to:vt) ++to; return vt; } if (k%4==2) { vt.pb(sz); vt.pb(-1ll); vt.pb(sz+1); for (auto &to:vt) ++to; //for (auto &o:vt) cout<<o<<' '; return vt; } vector<ll> vT=vt; vt.pb(sz); vt.pb(sz+1); for (auto &to:vt) { if (to>1) to++; } vt.pb(2); vector<ll> f((ll)vt.size()); ll sum=1; for (ll i=0; i<(ll)vt.size(); i++) { f[i]=1; for (ll j=0; j<i; j++) { if (vt[j]<vt[i]) { f[i]+=f[j]; f[i]=min(f[i],LLONG_MAX); } } sum+=f[i]; sum=min(sum,LLONG_MAX); //cout<<sum<<endl; } if (sum==k) return vt; for (auto &to:vT) { //cout<<to<<' '; //cout<<endl; to+=2; } vT.pb(sz+2); vT.pb(1); vT.pb(sz+3); vT.pb(0); return vT; } /* int main() { ios::sync_with_stdio(false); cin.tie(0); if (fopen("t.inp","r")) { freopen("teddy.inp","r",stdin); freopen("teddy.out","w",stdout); } int tt; cin>>tt; while (tt--) { ll k; cin>>k; for (auto &to:construct_permutation(k)) cout<<to<<' '; cout<<endl; } } */

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

perm.cpp: In function 'std::vector<int> sub_1(ll)':
perm.cpp:25:12: error: could not convert 'vt' from 'vector<long long int>' to 'vector<int>'
   25 |     return vt;
      |            ^~
      |            |
      |            vector<long long int>
perm.cpp: In function 'std::vector<int> construct_permutation(ll)':
perm.cpp:65:19: error: conversion from 'vector<int>' to non-scalar type 'vector<long long int>' requested
   65 |     vector<ll> vT=vt;
      |                   ^~
perm.cpp:103:12: error: could not convert 'vT' from 'vector<long long int>' to 'vector<int>'
  103 |     return vT;
      |            ^~
      |            |
      |            vector<long long int>