結果

問題 No.2921 Seated in Classroom
ユーザー Nichi10p
提出日時 2024-10-12 15:06:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,245 ms / 2,000 ms
コード長 287 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-12 15:06:59
合計ジャッジ時間 6,494 ms
ジャッジサーバーID
(参考情報)
judge / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
  N, M = map(int, input().split())

  n = (N + 3) // 4
  if N%4 == 0:
    x = 4*n
  else:
    x = 4*(n-1) + (8 - N%4)

  if M <= x:
    print(n)
  else:
    M -= x
    m = (M + 7) // 8
    print(n + m)

def main():
  T = int(input())
  for _ in range(T):
    solve()

main()
0