Submission #1103666

#TimeUsernameProblemLanguageResultExecution timeMemory
1103666Zero_OPCatfish Farm (IOI22_fish)C++17
3 / 100
78 ms17516 KiB
#include <bits/stdc++.h> #ifndef LOCAL #include <fish.h> #endif // LOCAL using namespace std; #define rep(i, l, r) for(int i = (l), _r = (r); i < _r; ++i) #define FOR(i, l, r) for(int i = (l), _r = (r); i <= _r; ++i) #define ROF(i, r, l) for(int i = (r), _l = (l); i >= _l; --i) #define all(v) begin(v), end(v) #define compact(v) v.erase(unique(all(v)), end(v)) #define sz(v) (int)v.size() #define dbg(x) "[" #x " = " << (x) << "]" template<typename T> bool minimize(T& a, const T& b){ if(a > b) return a = b, true; return false; } template<typename T> bool maximize(T& a, const T& b){ if(a < b) return a = b, true; return false; } using ll = long long; using ld = long double; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); template<typename T> T random_int(T l, T r){ return uniform_int_distribution<T>(l, r)(rng); } template<typename T> T random_real(T l, T r){ return uniform_real_distribution<T>(l, r)(rng); } const int MAX = 3e5 + 5; int n, m; struct fish{ int x, y, w; } fishes[MAX]; namespace subtask1{ bool check(){ rep(i, 0, m) if(fishes[i].x& 1) return false; return true; } ll solve(){ ll sum = 0; rep(i, 0, m){ if((i > 0) || (i < n - 1)){ sum += fishes[i].w; } } return sum; } } namespace subtask2{ bool check(){ for(int i = 0; i < m; ++i){ if(fishes[i].x > 1) return false; } return true; } ll solve(){ return 0; } } ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W){ n = N; m = M; for(int i = 0; i < M; ++i) fishes[i] = {X[i], Y[i], W[i]}; if(subtask1::check()) return subtask1::solve(); // if(subtask2::check()) return subtask2::solve(); return -1; } #ifdef LOCAL int main(){ cout << max_weights(5, 4, {0, 1, 4, 3}, {2, 1, 4, 3}, {5, 2, 1, 3}) << '\n'; } #endif // LOCAL

Compilation message (stderr)

fish.cpp: In function 'bool minimize(T&, const T&)':
fish.cpp:18:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   18 |     if(a > b) return a = b, true; return false;
      |     ^~
fish.cpp:18:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   18 |     if(a > b) return a = b, true; return false;
      |                                   ^~~~~~
fish.cpp: In function 'bool maximize(T&, const T&)':
fish.cpp:23:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   23 |     if(a < b) return a = b, true; return false;
      |     ^~
fish.cpp:23:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   23 |     if(a < b) return a = b, true; return false;
      |                                   ^~~~~~
#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...