結果

問題 No.1122 Plane Tickets
ユーザー koyumeishi
提出日時 2020-07-23 01:04:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 360 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-23 03:52:37
合計ジャッジ時間 3,447 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 44 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

a = list(map(int, input().split()))
def check(x):
  y = x + x
  res = 0
  for i in range(5):
    res += a[i] * x[i]
    s = sum(y[i:i+3])
    if s == 0:
      return (False, 0)
  return (True, res)

ans = None
for i in range(1, 2**5):
  x = [(i>>j)&1 for j in range(5)]
  y = check(x)
  if y[0]:
    if ans == None or ans > y[1]:
      ans = y[1]

print(ans)

0