結果
| 問題 | No.2921 Seated in Classroom |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2024-10-13 16:19:33 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 55 ms / 2,000 ms |
| コード長 | 570 bytes |
| 記録 | |
| コンパイル時間 | 150 ms |
| コンパイル使用メモリ | 53,264 KB |
| 実行使用メモリ | 9,184 KB |
| 最終ジャッジ日時 | 2026-07-05 23:19:05 |
| 合計ジャッジ時間 | 1,530 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 2921.cc: No.2921 Seated in Classroom - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
/* typedef */
using ll = long long;
/* global variables */
/* subroutines */
/* main */
int main() {
int tn;
scanf("%d", &tn);
while (tn--) {
int n, m;
scanf("%d%d", &n, &m);
int x0 = 0, x1 = n + m;
while (x0 + 1 < x1) {
int x = ((ll)x0 + x1) / 2;
if ((ll)x * 4 >= n && (ll)x * 8 >= n + m) x1 = x;
else x0 = x;
}
printf("%d\n", x1);
}
return 0;
}
tnakao0123