結果
| 問題 |
No.2921 Seated in Classroom
|
| コンテスト | |
| ユーザー |
prin_kemkem
|
| 提出日時 | 2024-10-12 14:46:23 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 149 ms / 2,000 ms |
| コード長 | 878 bytes |
| コンパイル時間 | 219 ms |
| コンパイル使用メモリ | 82,180 KB |
| 実行使用メモリ | 78,080 KB |
| 最終ジャッジ日時 | 2024-10-12 14:46:30 |
| 合計ジャッジ時間 | 2,066 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 |
ソースコード
from collections import defaultdict, deque, Counter
# from functools import cache
# import copy
from itertools import combinations, permutations, product, accumulate, groupby, chain
# from more_itertools import distinct_permutations
from heapq import heapify, heappop, heappush
import math
import bisect
# from pprint import pprint
from random import randint, shuffle, randrange
# from sortedcontainers import SortedSet, SortedList, SortedDict
import sys
# sys.setrecursionlimit(2000000)
input = lambda: sys.stdin.readline().rstrip('\n')
inf = float('inf')
mod1 = 10**9+7
mod2 = 998244353
def ceil_div(x, y): return -(-x//y)
#################################################
def solve():
N, M = map(int, input().split())
k = ceil_div(N, 4)
b = N%4
m = max(0, M-k*4-(4-b)%4)
return k+ceil_div(m, 8)
T = int(input())
for _ in range(T):
print(solve())
prin_kemkem