Submission #625854

#TimeUsernameProblemLanguageResultExecution timeMemory
625854kkkkkkkkCatfish Farm (IOI22_fish)C++17
0 / 100
57 ms5396 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 vk=0; bool first=true; for (int i=0;i<m;i++) if (w[i]%2==1) { first=false; break; } if (first) { for (int i=0;i<m;i++) vk+=w[i]; } else if (n<=2) { long long kaj_nula=0,kaj_eden=0; for (int i=0;i<m;i++) { if (x[i]==0) kaj_nula+=w[i]; else kaj_eden+=w[i]; } vk=max(kaj_nula,kaj_eden); } else { long long mat0[n]={0},mat1[n]={0}; for (int i=0;i<m;i++) { if (x[i]==0) mat0[y[i]]=w[i]; else vk+=w[i],mat1[y[i]]=w[i]; } for (int i=1;i<n;i++) { mat0[i]+=mat0[i-1]; mat1[i]+=mat1[i-1]; } for (int i=0;i<n;i++) vk=max(vk,vk+mat0[i]-mat1[i]); } return vk; }
#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...