Submission #920149

#TimeUsernameProblemLanguageResultExecution timeMemory
920149Faisal_SaqibCloud Computing (CEOI18_clo)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <map> #include <algorithm> using namespace std; const int N=2001; long long c[N],f[N],v[N],C[N],F[N],V[N]; long long buy[N*50][2]; long long sell[N*50][2]; int main() { int n,m; cin>>n>>m; for(int i=0;i<n;i++) { cin>>c[i]>>f[i]>>v[i]; } for(int i=0;i<m;i++) { cin>>C[i]>>F[i]>>V[i]; } // when all f=F for(int i=0;i<=(50*n);i++) buy[i][0]=1e18; buy[0][0]=0; for(int j=0;j<n;j++) { for(int i=0;i<=(50*n);i++) if(buy[i][0]!=1e18) buy[i+c[j]][1]=min(buy[i+c[j]][1],buy[i][0]+v[j]); for(int i=0;i<=(50*n);i++) buy[i][0]=min(buy[i][0],buy[i][1]); } for(int i=0;i<=(50*n);i++) sell[i][0]=-1e18; sell[0][0]=0; for(int j=0;j<n;j++) { for(int i=0;i<=(50*n);i++) if(sell[i][0]!=-1e18) sell[i+c[j]][1]=max(sell[i+c[j]][1],sell[i][0]+v[j]); for(int i=0;i<=(50*n);i++) sell[i][0]=max(sell[i][0],sell[i][1]); } long long ans=0; ll mx=-1e18; for(int i=0;i<=(50*n);i++) { mx=max(mx,sell[i][0]); ans=max(ans,mx-buy[i][0]); } cout<<ans<<'\n'; return 0; }

Compilation message (stderr)

clo.cpp: In function 'int main()':
clo.cpp:46:5: error: 'll' was not declared in this scope
   46 |     ll mx=-1e18;
      |     ^~
clo.cpp:49:6: error: 'mx' was not declared in this scope; did you mean 'm'?
   49 |      mx=max(mx,sell[i][0]);
      |      ^~
      |      m