結果
| 問題 | No.3241 Make Multiplication of 8 |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2026-01-07 02:18:22 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 144 ms / 2,000 ms |
| コード長 | 516 bytes |
| 記録 | |
| コンパイル時間 | 384 ms |
| コンパイル使用メモリ | 82,940 KB |
| 実行使用メモリ | 77,284 KB |
| 最終ジャッジ日時 | 2026-01-07 02:18:28 |
| 合計ジャッジ時間 | 5,558 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
from collections import Counter
def count_f2(n: int) -> int:
cnt = 0
x = n
while x > 0 and x % 2 == 0:
cnt += 1
x //= 2
return cnt
N = int(input())
freq = Counter()
ans = 0
for _ in range(N):
A, B = map(int, input().split())
match count_f2(A):
case 1:
freq[1] += B
case 2:
freq[2] += B
case x if x > 2:
ans += B
x = min(freq[1], freq[2])
ans += x
ans += (freq[1] - x) // 3
ans += (freq[2] - x) // 2
print(ans)
norioc