結果
| 問題 |
No.966 引き算をして門松列(その1)
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2022-01-14 16:54:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 731 bytes |
| コンパイル時間 | 189 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 77,568 KB |
| 最終ジャッジ日時 | 2024-11-19 10:35:55 |
| 合計ジャッジ時間 | 1,558 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | WA * 5 |
ソースコード
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 and c >= b-1:
ans1 += a-(b-2)+c-(b-1)
else:
ans1 = INF
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