Submission #625853

#TimeUsernameProblemLanguageResultExecution timeMemory
625853kkkkkkkkCatfish Farm (IOI22_fish)C++17
0 / 100
25 ms3564 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 mat[n][2]; memset(mat,0,sizeof(mat)); for (int i=0;i<m;i++) { if (x[i]==0) mat[y[i]][0]=w[i]; else vk+=w[i],mat[y[i]][1]=w[i]; } for (int i=n-2;i>=0;i--) { mat[i][0]+=mat[i+1][0]; mat[i][1]+=mat[i+1][1]; vk=max(vk,vk+mat[i][0]-mat[i][1]); } } 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...