Submission #711217

#TimeUsernameProblemLanguageResultExecution timeMemory
711217lolik123Cloud Computing (CEOI18_clo)C++14
0 / 100
1 ms468 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define sortshit second.first #define c second.second.first #define v second.second.second constexpr ll inf = 1e18; int n,m,rdz,tc,tf,tv; vector<pair <int, pair<int,pair<int,int>>>> arr; vector <ll> dp,temp; ll res; void em(int it, int af, int at, int ac, int av) { arr[it].f = af; arr[it].sortshit = at; arr[it].c = ac; arr[it].v = av; } void preprocess() { cin.tie(0) -> ios_base::sync_with_stdio(0); cin >> n; arr.resize(n); for(int i=0; i<n; i++) { cin >> tc >> tf >> tv; em(i, -tf, 69, tc, -tv); rdz += tc; } cin >> m; arr.resize(n+m); for(int i=0; i<m; i++) { cin >> tc >> tf >> tv; em(i+n, -tf, 420, -tc, tv); } } void solve() { sort(arr.begin(), arr.end()); dp.resize(rdz+69); temp.resize(rdz+69); for(int i=1; i<dp.size(); i++) dp[i] = -inf; for(auto a : arr) { temp = dp; for(int j=a.c; j<=rdz; j++) temp[j] = max(temp[j], dp[j - a.c] + a.v); swap(dp, temp); } for(auto x : dp) res = max(x,res); cout << res; } int main() { preprocess(); solve(); }

Compilation message (stderr)

clo.cpp: In function 'void solve()':
clo.cpp:56:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |  for(int i=1; i<dp.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...