結果

問題 No.2309 [Cherry 5th Tune D] 夏の先取り
ユーザー norikamenorikame
提出日時 2023-05-20 00:02:51
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,266 bytes
コンパイル時間 5,331 ms
コンパイル使用メモリ 309,664 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-23 02:07:02
合計ジャッジ時間 29,928 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
4,380 KB
testcase_01 AC 484 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 413 ms
4,380 KB
testcase_05 AC 339 ms
4,380 KB
testcase_06 AC 375 ms
4,380 KB
testcase_07 AC 392 ms
4,380 KB
testcase_08 AC 450 ms
4,380 KB
testcase_09 AC 446 ms
4,376 KB
testcase_10 AC 330 ms
4,380 KB
testcase_11 AC 403 ms
4,376 KB
testcase_12 AC 383 ms
4,376 KB
testcase_13 AC 501 ms
4,376 KB
testcase_14 AC 351 ms
4,380 KB
testcase_15 AC 413 ms
4,376 KB
testcase_16 AC 297 ms
4,376 KB
testcase_17 AC 424 ms
4,376 KB
testcase_18 AC 426 ms
4,380 KB
testcase_19 WA -
testcase_20 AC 348 ms
4,376 KB
testcase_21 AC 322 ms
4,376 KB
testcase_22 AC 306 ms
4,376 KB
testcase_23 AC 334 ms
4,376 KB
testcase_24 AC 530 ms
4,376 KB
testcase_25 WA -
testcase_26 AC 568 ms
4,380 KB
testcase_27 AC 357 ms
4,376 KB
testcase_28 AC 378 ms
4,380 KB
testcase_29 AC 446 ms
4,380 KB
testcase_30 AC 531 ms
4,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 1,177 ms
4,380 KB
testcase_36 AC 13 ms
4,376 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 14 ms
4,376 KB
testcase_39 AC 12 ms
4,376 KB
testcase_40 AC 10 ms
4,380 KB
testcase_41 AC 1,260 ms
4,376 KB
testcase_42 AC 1,272 ms
4,376 KB
testcase_43 AC 487 ms
4,376 KB
testcase_44 AC 412 ms
4,380 KB
testcase_45 AC 375 ms
4,376 KB
testcase_46 AC 360 ms
4,376 KB
testcase_47 AC 128 ms
4,376 KB
testcase_48 AC 30 ms
4,376 KB
testcase_49 AC 189 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

using ll = long long;

#define rep(i, n) for (int i=0; i<(int)(n); ++(i))
#define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i))
#define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i))
#define rep3r(i, m, n) for (int i=(int)(n)-1; (i)>=(int)(m); --(i))
#define all(x) (x).begin(), (x).end()

const int INF = (int)(1e9);
const vector<vector<int>> slst = {
	{ 1, 1, 0 }, { 0, 1, 1 }, { 1, 0, 1 }, { 1, 1, 1 }
};

int main() {
	int t0;
	cin >> t0;
	rep(i0, t0) {
		vector<int> a(3), b(4);
		rep(i, 3) cin >> a[i];
		rep(i, 4) cin >> b[i];
		vector<int> ord(4);
		iota(all(ord), 0);
		ll res = 0;
		do {
			int mval = INF;
			rep(j, 3) if (slst[ord[3]][j] == 1) mval = min(mval, a[j]);
			int sub = 0;
			while (sub <= mval) {
				auto ta = a;
				ll val = 0;
				val += sub * (ll)b[ord[3]];
				rep(j, 3) if (slst[ord[3]][j] == 1) ta[j] -= sub;
				rep(i, 4) {
					int mcnt = INF;
					rep(j, 3) if (slst[ord[i]][j] == 1) mcnt = min(mcnt, ta[j]);
					val += mcnt * (ll)b[ord[i]];
					rep(j, 3) if (slst[ord[i]][j] == 1) ta[j] -= mcnt;
				}
				res = max(res, val);
				++sub;
			}
		} while (next_permutation(all(ord)));
		cout << res << endl;
	}
	return 0;
}
0