Submission #947167

#TimeUsernameProblemLanguageResultExecution timeMemory
947167NextBasiliskCloud Computing (CEOI18_clo)C++14
100 / 100
365 ms1516 KiB
#include <bits/stdc++.h> #include <iostream> #define ll long long #define pb push_back #define F first #define S second using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; vector<pair<pair<ll,ll>, pair<ll,ll> > > action; for(ll i = 0; i < n; i++){ ll c, f, v; cin >> c >> f >> v; action.pb({{f, 1}, {v, c}}); } ll m; cin >> m; for(ll i = 0; i < m; i++){ ll c, f, v; cin >> c >> f >> v; action.pb({{f, 0}, {v, c}}); } sort(action.begin(), action.end()); vector<ll> ans(50 * n + 1, -1e18); ans[0] = 0; while(!action.empty()){ ll curC = action[action.size() - 1].S.S; ll curV = action[action.size() - 1].S.F; ll curT = action[action.size() - 1].F.S; if(curT == 1){ for(ll i = 50 * n - curC; i >= 0; i--){ if(ans[i + curC] < ans[i] - curV){ ans[i + curC] = ans[i] - curV; } } } else{ for(ll i = curC; i <= 50 * n; i++){ if(ans[i - curC] < ans[i] + curV){ ans[i - curC] = ans[i] + curV; } } } action.pop_back(); } ll ansG = 0; for(int i = 0; i < ans.size(); i++){ ansG = max(ansG, ans[i]); //cout << ans[i] << endl; } cout << ansG << endl; }

Compilation message (stderr)

clo.cpp: In function 'int main()':
clo.cpp:63:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |     for(int i = 0; i < ans.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...