Submission #652456

#TimeUsernameProblemLanguageResultExecution timeMemory
652456BlagojCatfish Farm (IOI22_fish)C++17
9 / 100
114 ms7264 KiB
#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) { bool Even = true, Less = true; long long sum1 = 0, sum2 = 0; for (auto x : X) { if (x % 2 != 0) { Even = false; } if (x > 1) { Less = false; } } if (Even) { long long sum = 0; for (auto x : W) { sum += x; } return sum; } if (Less) { long long m[N + 3][3]; memset(m, 0, sizeof(m)); for (int i = 0; i < M; i++) { m[Y[i]][X[i]] = W[i]; } for (int i = 1; i < N; i++) { m[i][0] += m[i - 1][0]; m[i][1] += m[i - 1][1]; } long long ans = max(m[N - 1][0], m[N - 1][1]); if (N == 2) { return ans; } for (int i = 0; i < N; i++) { ans = max(ans, m[i][0] + m[N - 1][1] - m[i][1]); } 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:9:13: warning: unused variable 'sum1' [-Wunused-variable]
    9 |   long long sum1 = 0, sum2 = 0;
      |             ^~~~
fish.cpp:9:23: warning: unused variable 'sum2' [-Wunused-variable]
    9 |   long long sum1 = 0, sum2 = 0;
      |                       ^~~~
fish.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^
#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...