Submission #920147

#TimeUsernameProblemLanguageResultExecution timeMemory
920147Faisal_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]);
    }
    ll ans=0;
    for(int i=0;i<=(50*n);i++)
    {
        ans=max(ans,sell[i][0]-buy[i][0]);
    }
    cout<<ans<<'\n';
    return 0;
}

Compilation message (stderr)

clo.cpp: In function 'int main()':
clo.cpp:45:5: error: 'll' was not declared in this scope
   45 |     ll ans=0;
      |     ^~
clo.cpp:48:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   48 |         ans=max(ans,sell[i][0]-buy[i][0]);
      |         ^~~
      |         abs
clo.cpp:50:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   50 |     cout<<ans<<'\n';
      |           ^~~
      |           abs