結果

問題 No.91 赤、緑、青の石
ユーザー kobikikobiki
提出日時 2016-03-13 10:55:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 713 bytes
コンパイル時間 469 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 71,640 KB
最終ジャッジ日時 2023-09-06 12:19:44
合計ジャッジ時間 4,043 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,460 KB
testcase_01 AC 74 ms
71,328 KB
testcase_02 AC 70 ms
71,424 KB
testcase_03 AC 69 ms
71,524 KB
testcase_04 AC 71 ms
71,188 KB
testcase_05 AC 69 ms
71,348 KB
testcase_06 AC 71 ms
71,556 KB
testcase_07 AC 71 ms
71,372 KB
testcase_08 AC 69 ms
71,296 KB
testcase_09 AC 70 ms
71,368 KB
testcase_10 AC 70 ms
71,424 KB
testcase_11 AC 71 ms
71,460 KB
testcase_12 AC 71 ms
71,300 KB
testcase_13 AC 70 ms
71,516 KB
testcase_14 AC 70 ms
71,460 KB
testcase_15 AC 70 ms
71,080 KB
testcase_16 AC 71 ms
71,320 KB
testcase_17 AC 71 ms
71,032 KB
testcase_18 AC 71 ms
71,472 KB
testcase_19 AC 71 ms
71,436 KB
testcase_20 AC 71 ms
71,364 KB
testcase_21 AC 72 ms
71,576 KB
testcase_22 AC 71 ms
71,416 KB
testcase_23 AC 71 ms
71,252 KB
testcase_24 AC 70 ms
71,192 KB
testcase_25 AC 69 ms
71,252 KB
testcase_26 AC 70 ms
71,008 KB
testcase_27 AC 72 ms
71,388 KB
testcase_28 AC 70 ms
71,640 KB
testcase_29 AC 71 ms
71,164 KB
testcase_30 AC 72 ms
71,360 KB
testcase_31 AC 70 ms
71,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Solve:
    def __init__(self):
        self.S = [int(i) for i in input().split()]

        self.a = min(self.S) # >= 0; True
        self.b = max(self.S)+1  # <= 10**7+1; False

    def solve(self):
        S = sorted(self.S)
        n = S.pop(0)
        S0, S1 = [s-n for s in S]

        # S0とS1を同じ数にしようとする
        d = (S1 - S0)//2
        # S0とS1を同じ数又は1個差にできる場合
        if S0 >= S1//3:
            n += (S0 + S1)//4 - int((S0 - d)%4 == (S1 - 3*d)%4 == 2)  # 2 2 になり得る場合のみ注意
        # 先にS0枯渇 && 残りのS1が5個で1個生成
        else:
            n += S0 + (S1 - 3*S0)//5

        return n

print(Solve().solve())
0