Submission #626397

#TimeUsernameProblemLanguageResultExecution timeMemory
626397kkkkkkkkCatfish Farm (IOI22_fish)C++17
0 / 100
84 ms8812 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 { 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 mat1[y[i]]=w[i]; } for (int i=1;i<n;i++) { mat0[i]+=mat0[i-1]; mat1[i]+=mat1[i-1]; } if (n<=2) vk=max(mat1[n-1],mat0[n-1]); else { vk=mat1[n-1]; for (int i=0;i<n;i++) vk=max(vk,mat1[n-1]+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...