結果
| 問題 |
No.3241 Make Multiplication of 8
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-05 10:17:31 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 160 ms / 2,000 ms |
| コード長 | 351 bytes |
| コンパイル時間 | 353 ms |
| コンパイル使用メモリ | 82,328 KB |
| 実行使用メモリ | 76,672 KB |
| 最終ジャッジ日時 | 2025-09-05 10:17:37 |
| 合計ジャッジ時間 | 5,482 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
def pow2(x):
cnt = 0
while x%2==0:
cnt += 1
x //= 2
return cnt
N = int(input())
C = {0:0,1:0,2:0,3:0}
for _ in range(N):
a,b = map(int,input().split())
n = pow2(a)
if n>=3:
C[3] += b
else:
C[n] += b
ans = C[3]
m = min(C[1],C[2])
ans += m
C[1] -= m
C[2] -= m
ans += C[1]//3+C[2]//2
print(ans)