Submission #1012070

#TimeUsernameProblemLanguageResultExecution timeMemory
1012070huutuanSki 2 (JOI24_ski2)C++14
Compilation error
0 ms0 KiB
#pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2") #include <bits/stdc++.h> using namespace std; using ll=long long; const int N=310; const ll inf=1e18; int n, z, cnt[N]; ll f[N][N][N], c[N]; pair<int, int> a[N]; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> z; for (int i=1; i<=n; ++i){ cin >> a[i].first >> a[i].second; ++a[i].first; ++cnt[a[i].first]; } for (int i=0; i<N; ++i) c[i]=inf; for (int i=1; i<=n; ++i) c[a[i].first+1]=min(c[a[i].first+1], a[i].second); for (int i=1; i<N; ++i) c[i]=min(c[i], c[i-1]); for (int i=0; i<N; ++i) for (int j=0; j<N; ++j) for (int k=0; k<N; ++k) f[i][j][k]=inf; f[0][1][0]=0; for (int i=0; i<N-1; ++i) for (int j=0; j<=n; ++j) for (int k=0; k<=n; ++k) if (f[i][j][k]!=inf){ for (int d=-cnt[i+1]; d<=k; ++d){ int x=cnt[i+1]+d; if (c[i+1]==inf && x-j>0) continue; f[i+1][max(j, x)][k-d]=min(f[i+1][max(j, x)][k-d], f[i][j][k]+1ll*max(0, x-j)*c[i+1]+1ll*(k-d)*z); } } ll ans=inf; for (int i=0; i<=n; ++i) ans=min(ans, f[N-1][i][0]); cout << ans << '\n'; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int32_t main()':
Main.cpp:24:77: error: no matching function for call to 'min(ll&, int&)'
   24 |    for (int i=1; i<=n; ++i) c[a[i].first+1]=min(c[a[i].first+1], a[i].second);
      |                                                                             ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from Main.cpp:3:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
Main.cpp:24:77: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   24 |    for (int i=1; i<=n; ++i) c[a[i].first+1]=min(c[a[i].first+1], a[i].second);
      |                                                                             ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from Main.cpp:3:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
Main.cpp:24:77: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   24 |    for (int i=1; i<=n; ++i) c[a[i].first+1]=min(c[a[i].first+1], a[i].second);
      |                                                                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
Main.cpp:24:77: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   24 |    for (int i=1; i<=n; ++i) c[a[i].first+1]=min(c[a[i].first+1], a[i].second);
      |                                                                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
Main.cpp:24:77: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   24 |    for (int i=1; i<=n; ++i) c[a[i].first+1]=min(c[a[i].first+1], a[i].second);
      |                                                                             ^