Submission #773925

#TimeUsernameProblemLanguageResultExecution timeMemory
773925jasminCatfish Farm (IOI22_fish)C++17
0 / 100
22 ms5564 KiB
#include "fish.h" using namespace std; #include<bits/stdc++.h> long long subtask1(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W){ long long ans=0; for(int i=0; i<N; i++){ ans+=W[i]; } return ans; } long long subtask2(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W){ long long sum0=0; long long sum1=0; for(int i=0; i<N; i++){ if(X[i]==0){ sum0+=W[i]; } else{ sum1+=W[i]; } } return max(sum0, sum1); } long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { if(N==1) return 0; bool sub1=true; bool sub2=true; for(int i=0; i<N; i++){ if(X[i]%2==1){ sub1=false; } if(X[i]>1){ sub2=false; } } if(sub1){ return subtask1(N, M, X, Y, W); } if(sub2){ return subtask2(N, M, X, Y, W); } }

Compilation message (stderr)

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:58:1: warning: control reaches end of non-void function [-Wreturn-type]
   58 | }
      | ^
#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...