Submission #725478

#TimeUsernameProblemLanguageResultExecution timeMemory
725478Rafi22Cloud Computing (CEOI18_clo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define st first #define nd second #define pb push_back #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define ll long long ll mod=1000000007; int inf=1000000007; ll infl=1000000000000000007; ll DP[2][2007*57]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); vector<pair<int,pair<int,int>>>V; int n,m; cin>>n; for(int i=0;i<n;i++) { int c,f,v; cin>>c>>f>>v; V.pb({f,{c,v}}); } cin>>m; for(int i=0;i<n;i++) { int c,f,v; cin>>c>>f>>v; V.pb({f,{-c,v}}); } sort(all(V),greater<pair<int,pair<int,int>>>()); for(int i=1;i<=n*50;i++) DP[0][i]=-infl; int i=0; for(auto x:V) { i++; int c=x.nd.st ll v=x.nd.nd; if(c>0) { for(int j=0;j<=n*50;j++) { DP[i%2][j]=DP[(i-1)%2][j]; if(j-c>=0) DP[i%2][j]=max(DP[i%2][j],DP[(i-1)%2][j-c]-v); } } else { c=-c; for(int j=0;j<=n*50;j++) { DP[i%2][j]=DP[(i-1)%2][j]; if(j+c<=n*50) DP[i%2][j]=max(DP[i%2][j],DP[(i-1)%2][j+c]+v); } } } ll ans=0; for(int j=0;j<=n*50;j++) ans=max(ans,DP[i%2][j]); cout<<ans; return 0; }

Compilation message (stderr)

clo.cpp: In function 'int main()':
clo.cpp:11:12: error: expected ',' or ';' before 'long'
   11 | #define ll long long
      |            ^~~~
clo.cpp:46:9: note: in expansion of macro 'll'
   46 |         ll v=x.nd.nd;
      |         ^~
clo.cpp:52:71: error: 'v' was not declared in this scope
   52 |                 if(j-c>=0) DP[i%2][j]=max(DP[i%2][j],DP[(i-1)%2][j-c]-v);
      |                                                                       ^
clo.cpp:61:74: error: 'v' was not declared in this scope
   61 |                 if(j+c<=n*50) DP[i%2][j]=max(DP[i%2][j],DP[(i-1)%2][j+c]+v);
      |                                                                          ^