제출 #1110696

#제출 시각아이디문제언어결과실행 시간메모리
1110696IcelastCloud Computing (CEOI18_clo)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <bits/stdc++.h> #define ll long long using namespace std; const ll maxn = 2*1e5+5, INF = 4e18+9; struct computer{ ll c, f, v; }; struct obj{ ll c, f, v; }; void solve(){ int n; cin >> n; vector<obj> a; for(int i = 1; i <= n; i++){ ll c, f, v; cin >> c >> f >> v; a.push_back({c, f, -v}); } int m; cin >> m; for(int i = 1; i <= m; i++){ ll c, f, v; cin >> c >> f >> v; a.push_back({-c, f, v}); } sort(a.begin(), a.end(), [](obj a, obj b){return a.f > b.f || (a.f == b.f && a.c > b.c)}); auto chmax = [&](ll &a, ll b) -> void{ a = max(a, b); }; int N = 2000*50; vector<ll> f(N+1, -INF), prv(N+1, -INF); f[0] = 0; for(obj it : a){ prv = f; fill(f.begin(), f.end(), INF); for(int j = 0; j <= N; j++){ f[j] = prv[j]; if(j-it.c >= 0 && j-it.c <= N) chmax(f[j], prv[j-it.c]+it.v); } } ll ans = 0; for(int j = 0; j <= N; j++){ chmax(ans, f[j]); } cout << ans; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); }

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

clo.cpp: In lambda function:
clo.cpp:28:92: error: expected ';' before '}' token
   28 |     sort(a.begin(), a.end(), [](obj a, obj b){return a.f > b.f || (a.f == b.f && a.c > b.c)});
      |                                                                                            ^
      |                                                                                            ;