Submission #625985

#TimeUsernameProblemLanguageResultExecution timeMemory
625985sword060Catfish Farm (IOI22_fish)C++17
0 / 100
61 ms5700 KiB
#include <bits/stdc++.h> #include "fish.h" using namespace std; long long max_weights(int x,int k,vector<int> a,vector<int> b,vector<int> c){ vector<pair<int,int>>l[2]; long long ans=0,cur=0; for(int i=0;i<k;i++){ l[(a[i]%2)].push_back({b[i],c[i]}); if((a[i]%2))cur+=c[i]; } sort(l[0].begin(),l[0].end()); sort(l[1].begin(),l[1].end()); ans=cur; int j=(int)l[0].size()-1; for(int i=(int)l[1].size()-1;i>=0;i--){ cur+=l[1][i].second; while(j>=0&&l[0][j].first>=l[1][i].first){ cur-=l[1][i].second; j--; } 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...