Submission #1083795

#TimeUsernameProblemLanguageResultExecution timeMemory
1083795SamueleVidCatfish Farm (IOI22_fish)C++17
0 / 100
1068 ms3464 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long constexpr int MAXN = 1e5 + 5; ll sum_tutto(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { ll sum = 0; for (auto x : W) sum += x; return sum; } ll res_minore_di_due(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { ll sum = 0; for (int i = 0; i < M; i ++) { if (X[i] == 1) sum += W[i]; } int pos[2][N]; for (int i = 0; i < 2; i ++) { for (int j = 0; j < N; j ++) pos[i][j] = 0; } for (int i = 0; i < M; i ++) { pos[X[i]][Y[i]] += W[i]; } ll best_res = sum; ll sum_zero = 0; ll sum_uno = 0; for (int i = 0; i < N; i ++) { sum_zero += pos[0][i]; sum_uno += pos[1][i]; best_res = max(best_res, sum - sum_uno + sum_zero); } return best_res; } ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { bool all_even = 1; for (auto x : X) if (x % 2) all_even = 0; if (all_even) sum_tutto(N, M, X, Y, W); bool minore_di_due = 1; for (auto x : X) if (x >= 2) minore_di_due = 0; res_minore_di_due(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:45:10: warning: variable 'minore_di_due' set but not used [-Wunused-but-set-variable]
   45 |     bool minore_di_due = 1;
      |          ^~~~~~~~~~~~~
fish.cpp:48:1: warning: no return statement in function returning non-void [-Wreturn-type]
   48 | }
      | ^
#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...