Submission #676762

#TimeUsernameProblemLanguageResultExecution timeMemory
676762Ninja_KunaiCatfish Farm (IOI22_fish)C++17
3 / 100
81 ms14376 KiB
/** * Author : Nguyen Tuan Vu * Created : 01.01.2023 **/ #pragma GCC optimize("O2") #pragma GCC target("avx,avx2,fma") #include<bits/stdc++.h> #define MASK(x) ((1ll)<<(x)) #define BIT(x, i) (((x)>>(i))&(1)) #define ALL(v) (v).begin(), (v).end() #define REP(i, n) for (int i = 0, _n = (n); i < _n; ++i) #define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i) #define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; --i) #define db(val) "["#val" = "<<(val)<<"] " template <class X, class Y> bool minimize(X &a, Y b) { if (a > b) return a = b, true; return false; } template <class X, class Y> bool maximize(X &a, Y b) { if (a < b) return a = b, true; return false; } using namespace std; mt19937 jdg(chrono::steady_clock::now().time_since_epoch().count()); int Rand(int l, int r) {return l + jdg() % (r - l + 1);} namespace sub1 { bool check(int m, vector <array <int, 3>> fishes) { REP(i, m) { if (fishes[i][0] & 1) return false; } return true; } long long solve(int m, vector <array <int, 3>> fishes) { //assert(1 == 0); long long ans = 0; REP(i, m) ans += fishes[i][2]; return ans; } } namespace sub2 { bool check(int m, vector <array <int, 3>> fishes) { REP(i, m) if (fishes[i][0] > 1) return false; return true; } long long solve(int m, vector <array <int, 3>> fishes) { assert(1 == 0); long long ans[2] = {0}; REP(i, m) ans[fishes[i][0]] += fishes[i][2]; return max(ans[0], ans[1]); } } long long max_weights(int n, int m, vector <int> X, vector <int> Y, vector <int> W) { vector <array <int, 3>> fishes; fishes.resize(m + 7); REP(i, m) fishes[i] = {X[i], Y[i], W[i]}; if (sub1::check(m, fishes)) return sub1::solve(m, fishes); else if (sub2::check(m, fishes)) return sub2::solve(m, fishes); return 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...