Submission #824898

#TimeUsernameProblemLanguageResultExecution timeMemory
824898alvingogoCatfish Farm (IOI22_fish)C++17
0 / 100
55 ms13796 KiB
#include "fish.h" #include <bits/stdc++.h> #define fs first #define sc second #define p_q priority_queue using namespace std; const long long inf=1e16; long long max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) { long long ans=0; vector<vector<pair<int,int> > > v(n); long long as[2]={0}; vector<vector<long long> > pre(2,vector<long long>(n)); for(int i=0;i<m;i++){ v[x[i]].push_back({y[i],w[i]}); pre[x[i]][y[i]]+=w[i]; as[x[i]]+=w[i]; } for(int i=1;i<n;i++){ pre[0][i]+=pre[0][i-1]; } for(int i=n-2;i>=0;i--){ pre[1][i]+=pre[1][i+1]; } if(n==2){ return max(as[0],as[1]); } else{ for(int i=0;i<n-1;i++){ ans=max(ans,pre[0][i]+pre[1][i+1]); } 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...