제출 #681497

#제출 시각아이디문제언어결과실행 시간메모리
681497penguin133Cloud Computing (CEOI18_clo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pi pair<int, int> #define pii pair<int, pi> #define fi first #define se second #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif vector <pii> stuf, ord; int n, m, memo[251][251][751]; bool cmp(pii a, pii b){ return a.se.fi < b.se.fi; } int dp(int x, int y, int rem){ //cerr << x << " " << y << " " << rem << '\n'; if(y <= 0)return 0; //assert(x >= 0 && if(memo[x][y][rem] != -1e18)return memo[x][y][rem]; //if(stuf[x-1].se.fi < ord[y-1].se.fi)return memo[x][y][rem] = dp(x, y - 1, rem); //cerr << x << " " <<y << " " << rem << " " << ord[y-1].fi << '\n'; int ans = dp(x, y - 1, rem); if(x > 0)ans = max(ans, dp(x - 1, y, rem)); if(x > 0 && stuf[x-1].se.fi >= ord[y-1].se.fi)ans = max(ans, dp(x - 1, y, rem + stuf[x-1].fi) - stuf[x-1].se.se); //cerr << rem << " " << ord[y-1].fi << '\n'; if(rem >= ord[y-1].fi)ans = max(ans, ord[y-1].se.se + dp(x, y - 1, rem - ord[y-1].fi)); //cerr << x << " " << y << " " << rem << " " << ans << '\n'; return memo[x][y][rem] = ans; } void solve(){ cin >> n; for(int i=1;i<=n;i++){ int a, b, c; cin >> a >> b >> c; stuf.push_back({a, {b, c}}); } cin >> m; for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)for(int k=0;k<=min(n * 50, 750);k++)memo[i][j][k] = -1e18; for(int i=1;i<=m;i++){ int a, b, c; cin >> a >> b >> c; ord.push_back({a, {b, c}}); } sort(stuf.begin(), stuf.end(), cmp); sort(ord.begin(), ord.end(), cmp); cout << dp(n, m, 0); //cout << dp(2, 2, 4) << '\n'; //cout << dp(1, 2, 8) << '\n'; } main(){ ios::sync_with_stdio(0);cin.tie(0); int tc = 1; //cin >> tc; for(int tc1=1;tc1<=tc;tc1++){ // cout << "Case #" << tc1 << ": "; solve(); } }

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

clo.cpp: In function 'void solve()':
clo.cpp:41:74: error: no matching function for call to 'min(long long int, int)'
   41 |  for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)for(int k=0;k<=min(n * 50, 750);k++)memo[i][j][k] = -1e18;
      |                                                                          ^
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:1:
/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:41:74: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   41 |  for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)for(int k=0;k<=min(n * 50, 750);k++)memo[i][j][k] = -1e18;
      |                                                                          ^
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:1:
/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:41:74: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   41 |  for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)for(int k=0;k<=min(n * 50, 750);k++)memo[i][j][k] = -1e18;
      |                                                                          ^
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:1:
/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:41:74: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   41 |  for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)for(int k=0;k<=min(n * 50, 750);k++)memo[i][j][k] = -1e18;
      |                                                                          ^
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:1:
/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:41:74: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   41 |  for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)for(int k=0;k<=min(n * 50, 750);k++)memo[i][j][k] = -1e18;
      |                                                                          ^
clo.cpp: At global scope:
clo.cpp:53:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   53 | main(){
      | ^~~~