結果
| 問題 | No.2921 Seated in Classroom | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-10-12 14:42:46 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 389 ms / 2,000 ms | 
| コード長 | 555 bytes | 
| コンパイル時間 | 2,102 ms | 
| コンパイル使用メモリ | 192,684 KB | 
| 最終ジャッジ日時 | 2025-02-24 17:40:10 | 
| ジャッジサーバーID (参考情報) | judge3 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 5 | 
ソースコード
#include <bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;
using ll = long long;
const ll mod = 1000000007;
//const ll mod = 998244353;
int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
ll t, n[200009], m[200009];
int main() {
	cin >> t;
	for (int i = 1; i <= t; i++) {
		cin >> n[i] >> m[i];
	}
	for (int i = 1; i <= t; i++) {
		ll x = (n[i]+3LL) / 4LL;
		ll sum = x * 8LL;
		if (sum - n[i] - m[i] >= 0)cout << x << endl;
		else {
			ll y = n[i] + m[i] - sum;
			x += ((y + 7LL) / 8LL);
			cout << x << endl;
		}
	}
}
            
            
            
        