結果
| 問題 |
No.2110 012 Matching
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-28 21:39:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,133 bytes |
| コンパイル時間 | 2,119 ms |
| コンパイル使用メモリ | 200,380 KB |
| 最終ジャッジ日時 | 2025-02-08 14:15:04 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 TLE * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef _RUTHEN
#include <debug.hpp>
#else
#define show(...) true
#endif
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;
void solve() {
V<ll> D(3);
rep(i, 3) cin >> D[i];
show(D);
V<pair<int, int>> P = {{0, 0}, {0, 1}, {0, 2}, {1, 1}, {1, 2}, {2, 2}};
ll ans = 0;
do {
// show(P);
auto DC = D;
ll cur = 0;
for (auto [a, b] : P) {
if (a != b) {
ll mn = min(D[a], D[b]);
ll s = (a + b) % 3;
cur += mn * s;
D[a] -= mn;
D[b] -= mn;
} else {
ll c = D[a] / 2;
ll s = (a + b) % 3;
cur += c * s;
D[a] -= c * 2;
}
}
ans = max(ans, cur);
show(D);
D = DC;
} while (next_permutation(P.begin(), P.end()));
cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int tt;
cin >> tt;
while (tt--) solve();
return 0;
}