結果

問題 No.3241 Make Multiplication of 8
ユーザー Shirotsume
提出日時 2025-08-22 23:55:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 2,800 ms
コンパイル使用メモリ 81,988 KB
実行使用メモリ 77,316 KB
最終ジャッジ日時 2025-08-22 23:56:27
合計ジャッジ時間 3,249 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
def debug(*x):print('debug:',*x, file=sys.stderr)
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 61 - 1
mod = 998244353

n = ii()

one, two, three = 0, 0, 0


for i in range(n):
    a, b = mi()
    if a % 8 == 0:
        three += b
    elif a % 4 == 0:
        two += b
    elif a % 2 == 0:
        one += b
        
ans = three

cnt = min(one, two)
ans += cnt
one -= cnt
two -= cnt
ans += two // 2 + one // 3

print(ans)
0