Submission #1245123

#TimeUsernameProblemLanguageResultExecution timeMemory
1245123guanexCatfish Farm (IOI22_fish)C++20
Compilation error
0 ms0 KiB
#include "fish.h" #include <vector> #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) { long long ans = 0; long long an = 0; vector<long long> suff(N+1, 0); vector<long long> pref = suff; vector<long long> preff = suff; vector<long long> suf = suff; for(int i = 0; i < (int)W.size(); ++i){ if(X[i] == 0){ ans += W[i]; pref[i] = W[i]; suff[i] = W[i]; }else{ an += W[i]; preff[i] = W[i]; suf[i] = W[i]; } } long long mx = max(ans, an); for(int i = 1; i < N; ++i){ pref[i] += pref[i-1]; preff[i] += preff[i-1]; } for(int i = N-2; i >= 0; --i){ suff[i] += suff[i+1]; suf[i] += suf[i+1]; } for(int i = 0; i < N; ++i){ mx = max(mx, pref[i], suf[i+1]); mx = max(mx, preff[i], suff[i+1]); } return mx; }

Compilation message (stderr)

In file included from /usr/include/c++/11/vector:60,
                 from fish.h:1,
                 from fish.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
fish.cpp:37:13:   required from here
/usr/include/c++/11/bits/stl_algobase.h:303:17: error: '__comp' cannot be used as a function
  303 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~