結果

問題 No.2921 Seated in Classroom
ユーザー forest3
提出日時 2025-01-16 16:41:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 425 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 1,875 ms
コンパイル使用メモリ 159,664 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-16 16:41:38
合計ジャッジ時間 6,119 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for( ll i = 0; i < n; i++ )
using ll = long long;

int main() {
	int T;
	cin >> T;
	rep(i, T) {
		int x, y;
		cin >> x >> y;
		int d = x / 4;
		int m = x % 4;
		ll ans = d;
		if(m) ans++;
		int r = d * 4;
		if(m) r += 8 - m;
		y -= r;
		y = max(0, y);
		ans += (y + 8 - 1) / 8;
		cout << ans << endl;
	}
}
0