Submission #785090

#TimeUsernameProblemLanguageResultExecution timeMemory
785090khshgCatfish Farm (IOI22_fish)C++17
0 / 100
73 ms14672 KiB
#include<bits/stdc++.h> using namespace std; long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { long long ans = 0; vector<int> is[2]; for(int i = 0; i < M; ++i) is[X[i]].push_back(i); for(int u : {0, 1}) sort(begin(is[u]), end(is[u]), [&](const int& i, const int& j) { return Y[i] < Y[j]; }); for(int u : is[1]) ans += W[u]; long long Sans = ans; int it = 0; for(int u : is[0]) { Sans += W[u]; while(it < (int)is[1].size() && Y[is[1][it]] <= Y[u]) { Sans -= W[is[1][it]]; ++it; } ans = max(ans, Sans); } 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...