結果
問題 | No.967 引き算をして門松列(その2) |
ユーザー | tamato |
提出日時 | 2020-01-13 20:55:26 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,011 bytes |
コンパイル時間 | 776 ms |
コンパイル使用メモリ | 86,968 KB |
実行使用メモリ | 78,388 KB |
最終ジャッジ日時 | 2023-08-23 13:40:55 |
合計ジャッジ時間 | 3,259 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
71,332 KB |
testcase_01 | AC | 74 ms
71,064 KB |
testcase_02 | AC | 73 ms
71,308 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
ソースコード
def main(): import sys input = sys.stdin.readline T = int(input()) for _ in range(T): A, B, C, x, y, z = map(int, input().split()) # b max if B <= 2: ans1 = 10**20 else: ans1 = 0 a = A b = B c = C if a >= b: ans1 += x * (a - (b-1)) a = b-1 if c >= b: ans1 += z * (c - (b-1)) c = b-1 if a == c: ans1 += min(x, z) # b min a, b, c = A, B, C if a == 1 or c == 1 or a == c == 2: ans2 = 10**20 else: ans2 = 0 if a == c: ans2 += min(x, z) a -= 1 if not b == min(a, b, c): ans2 += y * (b - (min(a, b, c) - 1)) ans = min(ans1, ans2) if ans == 10**20: print(-1) else: print(ans) if __name__ == '__main__': main()