結果
| 問題 |
No.966 引き算をして門松列(その1)
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2022-01-14 16:59:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 722 bytes |
| コンパイル時間 | 163 ms |
| コンパイル使用メモリ | 82,340 KB |
| 実行使用メモリ | 77,108 KB |
| 最終ジャッジ日時 | 2024-11-19 10:41:49 |
| 合計ジャッジ時間 | 1,318 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 WA * 3 |
ソースコード
t = int(input())
INF = 10**18
for i in range(t):
a, b, c = map(int, input().split())
base = 0
if a == c:
if a == 1:
base = INF
else:
a -= 1
base = 1
if a > c:
a, c = c, a
ans1 = base
if a < b and c < b:
pass
else:
if b >= 3:
if a >= b-2:
ans1 += a-(b-2)
if c >= b-1:
ans1 += c-(b-1)
else:
ans1 = INF
ans2 = base
if b < a and b < c:
ans2 = 0
else:
if a >= 2:
ans2 += b-(a-1)
else:
ans2 = INF
ans = min(ans1, ans2)
if ans < INF:
print(ans)
else:
print(-1)
brthyyjp