結果
| 問題 |
No.3288 Sloppy Land Grading
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-05 19:39:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 199 ms / 2,000 ms |
| コード長 | 975 bytes |
| コンパイル時間 | 460 ms |
| コンパイル使用メモリ | 82,356 KB |
| 実行使用メモリ | 77,296 KB |
| 最終ジャッジ日時 | 2025-10-05 19:39:27 |
| 合計ジャッジ時間 | 5,997 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 16 |
ソースコード
import sys
import os
IS_LOCAL = os.environ.get("LOCAL") == "true"
def debug(*args, sep=" ", end="\n", flush=False) -> None:
if IS_LOCAL:
print(*args, sep=sep, end=end, file=sys.stderr, flush=flush)
def yn(flg: bool) -> bool:
print('Yes' if flg else 'No')
return flg
def gcd(a, b):
a = abs(a); b = abs(b)
if a < b: a, b = b, a
while b > 0:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
def main():
readline = sys.stdin.readline
T = int(readline())
for _ in range(T):
A, B, C, x, y, z = map(int, readline().split())
L = [(A, x), (B, y), (C, z)]
L.sort()
A, x = L[0]
B, y = L[1]
C, z = L[2]
if x - y - z >= 0:
t = A
elif x + y - z >= 0:
t = B
else:
t = C
ans = x * abs(t - A) + y * abs(t - B) + z * abs(t - C)
print(ans)
if __name__ == "__main__":
main()