제출 #1265903

#제출 시각아이디문제언어결과실행 시간메모리
1265903syanvuLet's Win the Election (JOI22_ho_t3)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> #define SS ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr); #pragma optimize("g", on) #pragma GCC optimize("03") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native") #define int long long #define all(x) x.begin(),x.end() #define F first #define S second using namespace std; // using namespace __gnu_pbds; // #define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> const int LG = 20,N = 2e5+1,inf = 1e18,MOD = 998244353; const double eps = 1e-9; int T; void solve() { int n,k; cin>>n>>k; int a[n+1],b[n+1]; pair<int,int> p[n+1]; for(int i=1;i<=n;i++){ cin>>a[i]>>b[i]; b[i]=(b[i]==-1 ? inf : b[i]); p[i]={b[i],a[i]}; } sort(p+1,p+n+1); for(int i=1;i<=n;i++){ a[i]=p[i].S; b[i]=p[i].F; } vector<vector<vector<long double>>> dp(n+1,vector<vector<double>>(n+1,vector<double>(n+1,inf*1.0))); for(int i=0;i<=n;i++){ dp[0][i][0]=0; } for(int i=1;i<=n;i++){ for(int j=1;j<=min(i,k);j++){ for(int c=0;c<=j;c++){ if(c) dp[c][i][j]=min(dp[c][i][j],dp[c-1][i-1][j-1] + (b[i]*1.0)/(c*1.0)); if(c!=j) dp[c][i][j]=min(dp[c][i][j],dp[c][i-1][j-1] + (a[i]*1.0)/((c+1)*1.0)); dp[c][i][j]=min(dp[c][i][j],dp[c][i-1][j]); } } } long double ans=inf*1.0; for(int c=0;c<=k;c++){ ans=min(ans,dp[c][n][k]); } cout<<fixed<<setprecision(12)<<ans; return; } signed main() { // freopen("deleg.in","r",stdin); // freopen("deleg.out","w",stdout); SS int t = 1; if (T) { cin >> t; } while (t--) { solve(); } } /* */

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

Main.cpp: In function 'void solve()':
Main.cpp:38:103: error: no matching function for call to 'std::vector<std::vector<std::vector<long double> > >::vector(long long int, std::vector<std::vector<double> >)'
   38 |     vector<vector<vector<long double>>> dp(n+1,vector<vector<double>>(n+1,vector<double>(n+1,inf*1.0)));
      |                                                                                                       ^
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Main.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:653:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >]'
  653 |         vector(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:653:9: note:   template argument deduction/substitution failed:
Main.cpp:38:103: note:   deduced conflicting types for parameter '_InputIterator' ('long long int' and 'std::vector<std::vector<double> >')
   38 |     vector<vector<vector<long double>>> dp(n+1,vector<vector<double>>(n+1,vector<double>(n+1,inf*1.0)));
      |                                                                                                       ^
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Main.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:625:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::vector<std::vector<long double> > >]'
  625 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:625:43: note:   no known conversion for argument 1 from 'long long int' to 'std::initializer_list<std::vector<std::vector<long double> > >'
  625 |       vector(initializer_list<value_type> __l,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:607:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::vector<std::vector<long double> > >]'
  607 |       vector(vector&& __rv, const allocator_type& __m)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:607:23: note:   no known conversion for argument 1 from 'long long int' to 'std::vector<std::vector<std::vector<long double> > >&&'
  607 |       vector(vector&& __rv, const allocator_type& __m)
      |              ~~~~~~~~~^~~~
/usr/include/c++/11/bits/stl_vector.h:589:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::vector<std::vector<long double> > >; std::false_type = std::integral_constant<bool, false>]'
  589 |       vector(vector&& __rv, const allocator_type& __m, false_type)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:589:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/11/bits/stl_vector.h:585:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::vector<std::vector<long double> > >; std::true_type = std::integral_constant<bool, true>]'
  585 |       vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:585:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/11/bits/stl_vector.h:575:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&) [with _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::vector<std::vector<long double> > >]'
  575 |       vector(const vector& __x, const allocator_type& __a)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:575:28: note:   no known conversion for argument 1 from 'long long int' to 'const std::vector<std::vector<std::vector<long double> > >&'
  575 |       vector(const vector& __x, const allocator_type& __a)
      |              ~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:572:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >]'
  572 |       vector(vector&&) noexcept = default;
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:572:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/11/bits/stl_vector.h:553:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >]'
  553 |       vector(const vector& __x)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:553:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/11/bits/stl_vector.h:522:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = std::vector<std::vector<long double> >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::vector<std::vector<long double> > >]'
  522 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:522:47: note:   no known conversion for argument 2 from 'std::vector<std::vector<double> >' to 'const value_type&' {aka 'const std::vector<std::vector<long double> >&'}
  522 |       vector(size_type __n, const value_type& __value,
      |                             ~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/11/bits/stl_vector.h:510:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::vector<std::vector<long double> > >]'
  510 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:510:51: note:   no known conversion for argument 2 from 'std::vector<std::vector<double> >' to 'const allocator_type&' {aka 'const std::allocator<std::vector<std::vector<long double> > >&'}
  510 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |                             ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:497:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::vector<std::vector<long double> > >]'
  497 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:497:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/11/bits/stl_vector.h:487:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<std::vector<long double> >; _Alloc = std::allocator<std::vector<std::vector<long double> > >]'
  487 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:487:7: note:   candidate expects 0 arguments, 2 provided