結果

問題 No.2921 Seated in Classroom
ユーザー Ayuna
提出日時 2024-10-19 15:12:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 397 ms / 2,000 ms
コード長 361 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 69,976 KB
最終ジャッジ日時 2025-02-24 21:34:17
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

void solve(){
  ll n, m;
  cin >> n >> m;
  ll need = (n + 3) / 4;
  m -= need * 4;
  if (m <= 0){
    cout << need << endl;
    return;
  }
  m -= need * 4 - n;
  need += (m + 7) / 8;
  cout << need << endl;
  return;
}

int main(){
  int t;
  cin >> t;
  while(t--) solve();
}
0