結果
| 問題 |
No.1122 Plane Tickets
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2020-07-22 23:41:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 762 bytes |
| コンパイル時間 | 3,909 ms |
| コンパイル使用メモリ | 197,596 KB |
| 最終ジャッジ日時 | 2025-01-12 03:58:15 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 44 WA * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
using ll = long long;
vector<ll> a(5);
for (auto&& e : a) cin >> e;
ll res = 1e18;
vector<int> y;
auto dfs = [&](auto&& self) -> void {
if (size(y) == 5) {
for (int i = 0; i < 5; ++i) {
if (y[i] + y[(i + 1) % 5] + y[(i + 2) % 5] < 2) {
return;
}
}
ll cur = 0;
for (int i = 0; i < 5; ++i) {
cur += a[i] * y[i];
}
res = min(res, cur);
return;
}
for (int i = 0; i <= 2; ++i) {
y.push_back(i);
self(self);
y.pop_back();
}
};
dfs(dfs);
cout << res / 2 << '\n';
}
risujiroh