/**
* 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) {
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 time |
Memory |
Grader output |
1 |
Correct |
23 ms |
4052 KB |
Output is correct |
2 |
Correct |
27 ms |
4948 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
86 ms |
14320 KB |
Output is correct |
6 |
Correct |
87 ms |
14384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
4052 KB |
Output is correct |
2 |
Correct |
27 ms |
4948 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
86 ms |
14320 KB |
Output is correct |
6 |
Correct |
87 ms |
14384 KB |
Output is correct |
7 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
8 |
Halted |
0 ms |
0 KB |
- |