Submission #70886813


Source Code Expand

def f(a, b, c):
  if (b - c) % 3 != 0:
    return 10 ** 10
  return max(b, c)

t = int(input())
for _ in range(t):
  r, g, b = map(int, input().split())
  ans = 10 ** 10
  target = [f(r, g, b), f(g, b, r), f(b, r, g)]
  for tar in target:
    ans = min(ans, tar)
  if ans == 10 ** 10:
    ans = -1
  print(ans)

Submission Info

Submission Time
Task B - Balls of Three Colors
User shunta
Language Python (PyPy 3.10-v7.3.12)
Score 400
Code Size 324 Byte
Status AC
Exec Time 58 ms
Memory 76724 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 1
AC × 6
Set Name Test Cases
Sample 00-sample-001.txt
All 00-sample-001.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt
Case Name Status Exec Time Memory
00-sample-001.txt AC 55 ms 76396 KiB
01-001.txt AC 57 ms 76216 KiB
01-002.txt AC 57 ms 76724 KiB
01-003.txt AC 58 ms 76544 KiB
01-004.txt AC 57 ms 76280 KiB
01-005.txt AC 57 ms 76572 KiB