結果
| 問題 | No.3241 Make Multiplication of 8 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-22 23:55:50 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 119 ms / 2,000 ms |
| + 473µs | |
| コード長 | 597 bytes |
| 記録 | |
| コンパイル時間 | 236 ms |
| コンパイル使用メモリ | 96,104 KB |
| 実行使用メモリ | 86,144 KB |
| 最終ジャッジ日時 | 2026-07-14 09:54:45 |
| 合計ジャッジ時間 | 5,173 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
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)