結果

問題 No.2921 Seated in Classroom
ユーザー mahiro0o0o0
提出日時 2024-10-12 14:47:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 355 ms / 2,000 ms
コード長 596 bytes
コンパイル時間 3,400 ms
コンパイル使用メモリ 228,216 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 14:47:54
合計ジャッジ時間 5,765 ms
ジャッジサーバーID
(参考情報)
judge / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, k, n) for (ll i = (ll)(k); i < (ll)(n); i++)
#define repM(i, k, n) for (ll i = (ll)(k); i > (ll)(n); i--)
#define all(v) v.begin(), v.end()
using ll = long long;
ll mod = 998244353;

int main() {
  ll T;
  cin >> T;
  rep(i, T){
    ll N, M;
    cin >> N >> M;
    ll a = (N+3)/4;
    ll ans = a;
    M -= a*4 + a*4-N;
    if(M <= 0){
      cout << ans << endl;
    } else {
      ans += (M+7)/8;
      cout << ans << endl;
    }
  }
}
0