結果
問題 | No.2309 [Cherry 5th Tune D] 夏の先取り |
ユーザー | CoCo_Japan_pan |
提出日時 | 2023-05-20 17:12:30 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 149 ms / 3,000 ms |
コード長 | 2,855 bytes |
コンパイル時間 | 3,384 ms |
コンパイル使用メモリ | 224,916 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-01 07:23:56 |
合計ジャッジ時間 | 8,564 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 9 ms
5,248 KB |
testcase_01 | AC | 87 ms
5,376 KB |
testcase_02 | AC | 78 ms
5,376 KB |
testcase_03 | AC | 81 ms
5,376 KB |
testcase_04 | AC | 76 ms
5,376 KB |
testcase_05 | AC | 74 ms
5,376 KB |
testcase_06 | AC | 75 ms
5,376 KB |
testcase_07 | AC | 74 ms
5,376 KB |
testcase_08 | AC | 85 ms
5,376 KB |
testcase_09 | AC | 76 ms
5,376 KB |
testcase_10 | AC | 72 ms
5,376 KB |
testcase_11 | AC | 71 ms
5,376 KB |
testcase_12 | AC | 73 ms
5,376 KB |
testcase_13 | AC | 84 ms
5,376 KB |
testcase_14 | AC | 72 ms
5,376 KB |
testcase_15 | AC | 82 ms
5,376 KB |
testcase_16 | AC | 67 ms
5,376 KB |
testcase_17 | AC | 78 ms
5,376 KB |
testcase_18 | AC | 71 ms
5,376 KB |
testcase_19 | AC | 66 ms
5,376 KB |
testcase_20 | AC | 68 ms
5,376 KB |
testcase_21 | AC | 66 ms
5,376 KB |
testcase_22 | AC | 59 ms
5,376 KB |
testcase_23 | AC | 67 ms
5,376 KB |
testcase_24 | AC | 86 ms
5,376 KB |
testcase_25 | AC | 77 ms
5,376 KB |
testcase_26 | AC | 87 ms
5,376 KB |
testcase_27 | AC | 77 ms
5,376 KB |
testcase_28 | AC | 75 ms
5,376 KB |
testcase_29 | AC | 82 ms
5,376 KB |
testcase_30 | AC | 86 ms
5,376 KB |
testcase_31 | AC | 143 ms
5,376 KB |
testcase_32 | AC | 143 ms
5,376 KB |
testcase_33 | AC | 143 ms
5,376 KB |
testcase_34 | AC | 142 ms
5,376 KB |
testcase_35 | AC | 141 ms
5,376 KB |
testcase_36 | AC | 21 ms
5,376 KB |
testcase_37 | AC | 6 ms
5,376 KB |
testcase_38 | AC | 15 ms
5,376 KB |
testcase_39 | AC | 10 ms
5,376 KB |
testcase_40 | AC | 14 ms
5,376 KB |
testcase_41 | AC | 148 ms
5,376 KB |
testcase_42 | AC | 149 ms
5,376 KB |
testcase_43 | AC | 82 ms
5,376 KB |
testcase_44 | AC | 84 ms
5,376 KB |
testcase_45 | AC | 70 ms
5,376 KB |
testcase_46 | AC | 75 ms
5,376 KB |
testcase_47 | AC | 17 ms
5,376 KB |
testcase_48 | AC | 22 ms
5,376 KB |
testcase_49 | AC | 61 ms
5,376 KB |
ソースコード
#line 2 "/home/cocojapanpan/Procon_CPP/proconLibrary/lib/template/procon.hpp" #ifndef DEBUG // 提出時にassertはオフ #ifndef NDEBUG #define NDEBUG #endif // 定数倍高速化 #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #endif #include <bits/stdc++.h> using namespace std; using ll = long long; #define ALL(x) (x).begin(), (x).end() template <class T> using vec = vector<T>; template <class T, class S> inline bool chmax(T &a, const S &b) { return (a < b ? a = b, 1 : 0); } template <class T, class S> inline bool chmin(T &a, const S &b) { return (a > b ? a = b, 1 : 0); } template <class T> constexpr T INF = 1'000'000'000; template <> constexpr int INF<int> = 1'000'000'000; template <> constexpr ll INF<ll> = ll(INF<int>) * INF<int> * 2; #line 2 "main.cpp" ll solve() { ll A, B, C; cin >> A >> B >> C; ll X, Y, Z, W; cin >> X >> Y >> Z >> W; ll ans = 0; auto isValid = [&](ll x, ll y, ll z, ll w) { return 0 <= x && 0 <= y && 0 <= z && 0 <= w; }; auto calcEarn = [&](ll x, ll y, ll z, ll w) { if(!isValid(x, y, z, w)) return -1LL; return x * X + y * Y + z * Z + w * W; }; auto calc_x0 = [&](ll a, ll b, ll c) { ll x = 0; ll y = -a + c; ll z = -b + c; ll w = a + b - c; chmax(ans, calcEarn(x, y, z, w)); }; auto calc_y0 = [&](ll a, ll b, ll c) { ll x = a - c; ll y = 0; ll z = a - b; ll w = -a + b + c; chmax(ans, calcEarn(x, y, z, w)); }; auto calc_z0 = [&](ll a, ll b, ll c) { ll x = b - c; ll y = b - a; ll z = 0; ll w = a - b + c; chmax(ans, calcEarn(x, y, z, w)); }; auto calc_w0 = [&](ll a, ll b, ll c) { if((a + b + c) % 2) return; ll x = (a + b - c) / 2; ll y = (-a + b + c) / 2; ll z = (a - b + c) / 2; ll w = 0; chmax(ans, calcEarn(x, y, z, w)); }; auto calc_w1 = [&](ll a, ll b, ll c) { if((a + b + c - 1) % 2) return; ll x = (a + b - c - 1) / 2; ll y = (-a + b + c - 1) / 2; ll z = (a - b + c - 1) / 2; ll w = 1; chmax(ans, calcEarn(x, y, z, w)); }; vec<function<void(ll, ll, ll)>> funList = { calc_x0, calc_y0, calc_z0, calc_w0, calc_w1 }; for(ll a = 0; a <= A; a++) { for(auto fun : funList) { fun(a, B, C); } } for(ll b = 0; b <= B; b++) { for(auto fun : funList) { fun(A, b, C); } } for(ll c = 0; c <= C; c++) { for(auto fun : funList) { fun(A, B, c); } } return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--) { cout << solve() << "\n"; } }