Submission #864846

#TimeUsernameProblemLanguageResultExecution timeMemory
864846dead0neCloud Computing (CEOI18_clo)C++17
Compilation error
0 ms0 KiB
#pragma GCC optimize("unroll-loops,Ofast,O3") #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define spc << " " << #define endl "\n" #define all(x) x.begin(), x.end() #define int long long #define ii pair<int,int> #define vi vector<int> #define vii vector<ii> #define st first #define nd second #define inf 1000000009 #define MOD 1000000007 #define lim 200005 using namespace std; int n,m; vector<tuple<int, int, int>> vec; // frequence, core, value int dp[4001][5001]; int calc(int cur, int cor){ if(cur>=n+m) return 0; if(dp[cur][cor]!=-1) return dp[cur][cor]; if(cor >= (n+m-cur)*50){ if(get<1>(vec[cur]) > 0){ return dp[cur][cor] = calc(cur+1, cor); } else{ return dp[cur][cor] = calc(cur+1, cor + get<1>(vec[cur])) + get<2>(vec[cur]); } } dp[cur][cor] = calc(cur+1, cor); if(cor + get<1>(vec[cur]) >= 0) dp[cur][cor] = max(dp[cur][cor], calc(cur+1, cor + get<1>(vec[cur])) + get<2>(vec[cur])); return dp[cur][cor]; } void solve(){ cin >> n; for(int i=1; i<=n; i++){ int c,f,v; cin >> c >> f >> v; vec.pb({f, c, -v}); } cin >> m; for(int i=1; i<=m; i++){ int c,f,v; cin >> c >> f >> v; vec.pb({f, -c, v}); } for(int i=0; i<=n+m; i++) for(int j=0; j<=min(5000, (n+m)*50); j++) dp[i][j]=-1; sort(all(vec), greater<tuple<int, int, int>>()); //for(auto i:vec) cerr << get<0>(i) spc get<1>(i) spc get<2>(i) << endl; cout << max(calc(0, 0), 0ll) << endl; } signed main(){ ios_base::sync_with_stdio(false);cin.tie(0); #ifdef Local freopen("in","r",stdin); freopen("out","w",stdout); #endif int t=1; //cin >> t; while(t--) solve(); }

Compilation message (stderr)

clo.cpp: In function 'void solve()':
clo.cpp:59:65: error: no matching function for call to 'min(int, long long int)'
   59 |     for(int i=0; i<=n+m; i++) for(int j=0; j<=min(5000, (n+m)*50); j++) dp[i][j]=-1;
      |                                                                 ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from clo.cpp:2:
/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:
clo.cpp:59:65: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   59 |     for(int i=0; i<=n+m; i++) for(int j=0; j<=min(5000, (n+m)*50); j++) dp[i][j]=-1;
      |                                                                 ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from clo.cpp:2:
/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:
clo.cpp:59:65: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   59 |     for(int i=0; i<=n+m; i++) for(int j=0; j<=min(5000, (n+m)*50); j++) dp[i][j]=-1;
      |                                                                 ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from clo.cpp:2:
/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:
clo.cpp:59:65: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   59 |     for(int i=0; i<=n+m; i++) for(int j=0; j<=min(5000, (n+m)*50); j++) dp[i][j]=-1;
      |                                                                 ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from clo.cpp:2:
/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:
clo.cpp:59:65: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   59 |     for(int i=0; i<=n+m; i++) for(int j=0; j<=min(5000, (n+m)*50); j++) dp[i][j]=-1;
      |                                                                 ^