結果

問題 No.1122 Plane Tickets
ユーザー iiljjiiljj
提出日時 2020-07-23 16:10:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 720 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 57,144 KB
最終ジャッジ日時 2023-09-05 22:21:58
合計ジャッジ時間 4,894 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 328 ms
57,004 KB
testcase_01 AC 330 ms
56,812 KB
testcase_02 AC 320 ms
57,092 KB
testcase_03 AC 312 ms
56,916 KB
testcase_04 AC 311 ms
56,792 KB
testcase_05 AC 313 ms
57,080 KB
testcase_06 AC 331 ms
56,944 KB
testcase_07 AC 324 ms
56,812 KB
testcase_08 WA -
testcase_09 AC 321 ms
57,100 KB
testcase_10 AC 320 ms
56,824 KB
testcase_11 AC 320 ms
56,704 KB
testcase_12 AC 317 ms
57,116 KB
testcase_13 AC 316 ms
56,896 KB
testcase_14 AC 319 ms
57,008 KB
testcase_15 AC 324 ms
56,716 KB
testcase_16 AC 325 ms
57,064 KB
testcase_17 AC 325 ms
57,128 KB
testcase_18 AC 321 ms
56,920 KB
testcase_19 AC 314 ms
56,984 KB
testcase_20 AC 320 ms
57,016 KB
testcase_21 AC 323 ms
56,936 KB
testcase_22 AC 322 ms
56,860 KB
testcase_23 AC 317 ms
57,136 KB
testcase_24 AC 323 ms
56,972 KB
testcase_25 AC 315 ms
56,744 KB
testcase_26 AC 314 ms
56,944 KB
testcase_27 AC 306 ms
57,104 KB
testcase_28 AC 330 ms
56,736 KB
testcase_29 AC 317 ms
57,144 KB
testcase_30 AC 311 ms
56,964 KB
testcase_31 AC 314 ms
56,908 KB
testcase_32 AC 310 ms
56,920 KB
testcase_33 AC 311 ms
56,820 KB
testcase_34 AC 311 ms
57,120 KB
testcase_35 AC 314 ms
56,960 KB
testcase_36 AC 311 ms
56,936 KB
testcase_37 AC 308 ms
56,988 KB
testcase_38 AC 304 ms
56,816 KB
testcase_39 AC 307 ms
56,764 KB
testcase_40 AC 319 ms
56,996 KB
testcase_41 AC 311 ms
56,960 KB
testcase_42 AC 314 ms
57,012 KB
testcase_43 AC 317 ms
56,948 KB
testcase_44 AC 314 ms
56,784 KB
testcase_45 AC 308 ms
56,844 KB
testcase_46 AC 310 ms
56,928 KB
testcase_47 AC 312 ms
56,932 KB
testcase_48 AC 309 ms
57,108 KB
testcase_49 AC 322 ms
57,052 KB
testcase_50 AC 318 ms
56,728 KB
testcase_51 AC 310 ms
57,128 KB
testcase_52 AC 309 ms
56,980 KB
testcase_53 AC 316 ms
56,936 KB
testcase_54 AC 308 ms
56,800 KB
testcase_55 AC 305 ms
56,860 KB
testcase_56 AC 301 ms
56,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
from scipy.optimize import linprog

u, v, w, x, y = map(int, input().split())

# 最小化する目的関数 = -x1 - x2 - x3 - x4 - x5
c = [-1, -1, -1, -1, -1]

# 下 2 行で, A [x1; x2; x3; x4; x5] <= b
A = [[1, 0, 0, 1, 1], [1, 1, 0, 0, 1], [1, 1, 1, 0, 0], [0, 1, 1, 1, 0], [0, 0, 1, 1, 1]]  # 決定変数の係数
b = [u, v, w, x, y]

# 値域制約
x1 = (0, None)
x2 = (0, None)
x3 = (0, None)
x4 = (0, None)
x5 = (0, None)

# 最小化問題として解く
ans = linprog(c, A_ub=A, b_ub=b, bounds=(x1, x2, x3, x4, x5), method='simplex')

# 最大化問題の解(最小化問題の解×(-1))
ans = -ans.fun
if ans > pow(2, 50):
    print(int(ans - 0.5))
else:
    print(int(ans + 0.001))
0