結果

問題 No.3241 Make Multiplication of 8
ユーザー i_taku
提出日時 2025-08-29 13:20:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 315 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 82,528 KB
実行使用メモリ 77,392 KB
最終ジャッジ日時 2025-08-29 13:21:01
合計ジャッジ時間 4,392 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
cnt = [0] * 4
for _ in range(N):
    a, b = map(int, input().split())
    two = 0
    while a % 2 == 0:
        a //= 2
        two += 1
    cnt[min(3, two)] += b
ans = cnt[3]
if cnt[1] < cnt[2]:
    ans += cnt[1] + (cnt[2] - cnt[1]) // 2
else:
    ans += cnt[2] + (cnt[1] - cnt[2]) // 3
print(ans)
0