結果
| 問題 |
No.2921 Seated in Classroom
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-12 15:02:57 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 242 ms / 2,000 ms |
| コード長 | 1,410 bytes |
| コンパイル時間 | 12,581 ms |
| コンパイル使用メモリ | 387,904 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-12 15:03:12 |
| 合計ジャッジ時間 | 14,438 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 |
ソースコード
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(clippy::needless_range_loop)]
#![allow(clippy::comparison_chain)]
#![allow(clippy::nonminimal_bool)]
#![allow(clippy::neg_multiply)]
#![allow(dead_code)]
#![allow(clippy::collapsible_else_if)]
use proconio::{
fastout, input, input_interactive,
marker::{Chars, Usize1},
};
use std::cmp::Reverse;
use std::collections::BinaryHeap;
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque};
use std::mem::swap;
//const MOD: usize = 1e9 as usize + 7;
const MOD: usize = 998244353;
// const MOD: usize = 2147483647;
#[macro_export]
macro_rules! max {
($x: expr) => ($x);
($x: expr, $( $y: expr ),+) => {
std::cmp::max($x, max!($( $y ),+))
}
}
#[macro_export]
macro_rules! min {
($x: expr) => ($x);
($x: expr, $( $y: expr ),+) => {
std::cmp::min($x, min!($( $y ),+))
}
}
fn main() {
input! {
T:usize,
}
for _ in 0..T {
input! {
M:usize,
N:usize,
}
let x1 = if M % 4 == 0 { M / 4 } else { M / 4 + 1 };
let mut N = N as i64;
N -= (4 * x1 + 4 * x1 - M) as i64;
if N <= 0 {
println!("{}", x1);
} else {
let x2 = if N % 8 == 0 { N / 8 } else { N / 8 + 1 };
let ans = x1 + x2 as usize;
println!("{}", ans);
}
}
}