Submission #834714

#TimeUsernameProblemLanguageResultExecution timeMemory
834714GordonRemzi007Catfish Farm (IOI22_fish)C++17
6 / 100
68 ms9936 KiB
#include <iostream> #include <vector> #define ll long long using namespace std; ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) { ll res; if(n == 2) { ll r0 = 0, r1 = 0; for(ll i = 0; i < m; i++) { if(x[i]) r1+=w[i]; else r0+=w[i]; } res = max(r0, r1); } else { vector<ll> pref0(n), pref1(n); for(int i = 0; i < m; i++) { if(x[i]) pref1[y[i]] = w[i]; else pref0[y[i]] = w[i]; } for(int i = 1; i < n; i++) { pref0[i]+=pref0[i-1]; pref1[i]+=pref1[i-1]; } res = pref1[n-1]; for(int i = 0; i < n; i++) res = max(res, pref0[i]+pref1[n-1]-pref1[i]); } return res; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...