Submission #849329

#TimeUsernameProblemLanguageResultExecution timeMemory
849329sonamooCatfish Farm (IOI22_fish)C++17
9 / 100
69 ms9584 KiB
#include <fish.h> #include <bits/stdc++.h> #define MAX 200005 #define INF 1e12 #define ll long long #define pii pair<int,int> #define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); using namespace std; vector<pair<ll,ll> > fish; long long ans; long long a1[100005] , a2[100005] , ps1[100005] , ps2[100005]; long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { int flag1 = 1 , flag2 = 1; for (int i = 0; i < M; i++) { if (X[i] >= 2) flag2 = 0; if (X[i]%2 == 1) flag1 = 0; if (X[i] == 0) a1[Y[i]+1] += W[i]; else a2[Y[i]+1] += W[i]; ans += W[i]; } if (flag1 == 1) return ans; ans = 0; if (flag2 == 1) { for (int i = 1; i <= N; i++) { ps1[i] = ps1[i-1]+a1[i]; ps2[i] = ps2[i-1]+a2[i]; } for (int i = 0; i <= N; i++) { if (N >= 3) ans = max(ans , ps2[N]-ps2[i]+ps1[i]); ans = max(ans , ps2[i]); ans = max(ans , ps1[i]); } return ans; } }

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:43:1: warning: control reaches end of non-void function [-Wreturn-type]
   43 | }
      | ^
#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...