Submission #729824

#TimeUsernameProblemLanguageResultExecution timeMemory
729824caganyanmazCatfish Farm (IOI22_fish)C++17
0 / 100
86 ms14688 KiB
#include <bits/stdc++.h> #define pb push_back #define int int64_t using namespace std; int max_weights(int32_t n, int32_t m, vector<int32_t> x, vector<int32_t> y, vector<int32_t> w) { array<vector<array<int, 2>>, 2> t; for (int i = 0; i < m; i++) if (x[i] <= 1) t[x[i]].pb({y[i], w[i]}); else assert(false); for (int i = 0; i < 2; i++) sort(t[i].begin(), t[i].end()); array<vector<int>, 2> p; for (int i = 0; i < 2; i++) { p[i] = vector<int>(n+1); int _next = 0; for (int j = 1; j <= n; j++) { p[i][j] = p[i][j-1]; if (_next < t[i].size() && j > t[i][_next][0]) p[i][j] += t[i][_next++][1]; } } int best = 0; for (int i = 0; i <= n; i++) best = max(best, p[0][i] + p[1][n] - p[1][i]); return best; }

Compilation message (stderr)

fish.cpp: In function 'int64_t max_weights(int32_t, int32_t, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:24:35: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::vector<std::array<long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |                         if (_next < t[i].size() && j > t[i][_next][0])
      |                             ~~~~~~^~~~~~~~~~~~~
#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...