제출 #598287

#제출 시각아이디문제언어결과실행 시간메모리
5982871binCloud Computing (CEOI18_clo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; const int MAX = 1e5 + 5; struct t{ ll c, f, p; bool operator <(const t & x){ if(f == x.f) return p < x.p; return f > x.f; } }; ll n, m, c, f, p, dp[MAX]; vector<t> v; int main(void){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; while(n--){ cin >> c >> f >> p; v.push_back({c, f, -p); } cin >> m; while(m--){ cin >> c >> f >> p; v.push_back({c, f, p}); } sort(all(v)); memset(dp, 0xc1, sizeof(dp)); dp[0] = 0; for(auto& x : v){ if(x.p < 0){ for(int i = MAX - 1; i >= x.c; i--) dp[i] = max(dp[i], dp[i - x.c] + x.p); } else{ for(int i = 0; i + x.c < MAX; i++) dp[i] = max(dp[i], dp[i + x.c] + x.p); } } ll ans = 0; for(int i = 0; i < MAX; i++) ans = max(ans, dp[i]); cout << ans; return 0; }

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

clo.cpp: In function 'int main()':
clo.cpp:25:30: error: expected '}' before ')' token
   25 |         v.push_back({c, f, -p);
      |                     ~        ^