結果

問題 No.112 ややこしい鶴亀算
ユーザー lam6er
提出日時 2025-03-31 17:18:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 452 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 82,576 KB
実行使用メモリ 54,316 KB
最終ジャッジ日時 2025-03-31 17:19:11
合計ジャッジ時間 2,215 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))

s_candidate1 = a[0] + 2
s_candidate2 = a[0] + 4

def is_valid(s):
    for num in a:
        if (num + 2 != s) and (num + 4 != s):
            return False
    return True

s = None
if is_valid(s_candidate1):
    s = s_candidate1
else:
    s = s_candidate2

c = (4 * n - s) // 2
t = n - c

# Verify the count of cranes
count_c = 0
for num in a:
    if num + 2 == s:
        count_c += 1

print(c, t)
0