# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1055933 | 2024-08-13T06:40:50 Z | amirhoseinfar1385 | Catfish Farm (IOI22_fish) | C++17 | 0 ms | 0 KB |
#include "fish.h" #include<bits/stdc++.h> using namespace std; long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { long long sum1=0,sum0=0,res=0,f=0; n=N; for(int i=0;i<n;i++){ res+=W[i]; if(X[i]==0){ sum0+=W[i]; }else if(X[i]==1){ sum1+=W[i]; }else{ f=1; } } if(f==0){ return max(sum1,sum0); } return res; }