結果

問題 No.1122 Plane Tickets
ユーザー risujiroh
提出日時 2020-07-22 21:43:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 715 bytes
コンパイル時間 1,929 ms
コンパイル使用メモリ 194,012 KB
最終ジャッジ日時 2025-01-12 02:29:46
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 44 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
  for (int bt = 0; bt < 1 << 5; ++bt) {
    bool ok = true;
    for (int i = 0; i < 5; ++i) {
      if (bt >> i & 1) continue;
      if (bt >> (i + 1) % 5 & 1) continue;
      if (bt >> (i + 2) % 5 & 1) continue;
      ok = false;
      break;
    }
    if (ok) {
      ll cur = 0;
      for (int i = 0; i < 5; ++i) {
        if (bt >> i & 1) {
          cur += a[i];
        }
      }
      res = min(res, cur);
    }
  }
  cout << res << '\n';
}
0