結果

問題 No.2309 [Cherry 5th Tune D] 夏の先取り
ユーザー norikamenorikame
提出日時 2023-05-19 23:48:18
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,450 bytes
コンパイル時間 6,685 ms
コンパイル使用メモリ 314,792 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-20 02:54:39
合計ジャッジ時間 7,211 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 35
権限があれば一括ダウンロードができます

ソースコード

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), svals;
iota(all(ord), 0);
svals.push_back(0);
rep(i, 3) rep3(j, i+1, 3) svals.push_back(abs(a[i]-a[j]));
sort(all(svals));
svals.erase(unique(all(svals)), svals.end());
ll res = 0;
do {
for (const int& sub : svals) rep(i1, 4) {
ll val = 0;
auto ta = a;
rep(i, 4) {
{
int mcnt = sub;
rep(j, 3) if (slst[i1][j] == 1) mcnt = min(mcnt, ta[j]);
val += mcnt * (ll)b[i1];
rep(j, 3) if (slst[i1][j] == 1) ta[j] -= mcnt;
}
{
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);
}
} while (next_permutation(all(ord)));
cout << res << endl;
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0