Submission #567886

#TimeUsernameProblemLanguageResultExecution timeMemory
567886ShivanshJCloud Computing (CEOI18_clo)C++17
100 / 100
553 ms2252 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int MAX=1e5+5; const int INF=1e18; const int MOD=1e9+7; const int MAXL=61; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); //cout<<setprecision(6)<<fixed; //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); int n,m; cin>>n; vector<vector<int>>info; //freq, -delta profit, delta core for(int i=0;i<n;i++) { int c,f,v; cin>>c>>f>>v; info.push_back({f,v,c}); } cin>>m; for(int i=0;i<m;i++) { int c,f,v; cin>>c>>f>>v; info.push_back({f,-v,-c}); } sort(info.begin(),info.end(),greater<vector<int>>()); int dp[MAX][2]; for(int i=1;i<MAX;i++) { dp[i][1]=-INF; } dp[0][1]=0; int curr=0; for(int i=0;i<info.size();i++) { for(int j=0;j<MAX;j++) { dp[j][curr]=dp[j][curr^1]; if(j-info[i][2]>=0 && j-info[i][2]<MAX) { dp[j][curr]=max(dp[j][curr],dp[j-info[i][2]][curr^1]-info[i][1]); } } curr^=1; } curr^=1; int ans=0; for(int i=0;i<MAX;i++) { ans=max(ans,dp[i][curr]); } cout<<ans; return 0; }

Compilation message (stderr)

clo.cpp: In function 'int main()':
clo.cpp:36:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i=0;i<info.size();i++) {
      |                 ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...