Submission #666245

#TimeUsernameProblemLanguageResultExecution timeMemory
666245BananCatfish Farm (IOI22_fish)C++17
6 / 100
91 ms10188 KiB
#include "fish.h" #include <bits/stdc++.h> using namespace std; using ll = long long; #define double long double #define endl '\n' #define sz(a) (int)a.size() #define pb push_back #define fs first #define sc second #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() ll const INF = LONG_LONG_MAX; long long max_weights(int n, int m, std::vector<int> x, std::vector<int> y, std::vector<int> w) { ll ans1=0, ans2=0, ans=0; if(n==2) { for(int i=0;i<m;i++) { if(x[i]==0){ans1+=w[i];} else{ans2+=w[i];} } ans=max(ans1, ans2); } else { vector<ll> val(n, 0); for(int i=0;i<m;i++) { if(x[i]==0){val[y[i]]+=w[i];} else if(x[i]==1) {ans+=w[i];val[y[i]]-=w[i];} } ll cur=ans; for(int i=0;i<n;i++) { cur+=val[i]; ans=max(ans, cur); } } return ans; }
#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...