結果
問題 | No.2622 Dam |
ユーザー |
|
提出日時 | 2024-02-09 21:58:10 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 2,424 bytes |
コンパイル時間 | 10,761 ms |
コンパイル使用メモリ | 402,460 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 15:14:35 |
合計ジャッジ時間 | 11,425 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
ソースコード
fn main() {input!{t: usize,vxoiqr: [(i64, i64, i64, i64, i64, i64); t],}for i in 0..t {// 1周分の増減を見る(in-out)let up = (vxoiqr[i].3 - vxoiqr[i].2) * vxoiqr[i].5;let down = -(vxoiqr[i].2 * (vxoiqr[i].5 - vxoiqr[i].4));let dif = up - down;if dif > 0 { println!("Overflow"); } // 初期値より下回ることがない = 増え続けるelse {// 1周目の時点のmaxがVを超えないかを見るlet xmax = vxoiqr[i].1 + up;if vxoiqr[i].0 < xmax { println!("Overflow"); }else {if dif < 0 { println!("Zero"); }else { println!("Safe"); }}}}}// ---------- begin input macro ----------#[macro_export]macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();input_inner!{iter, $($r)*}};($($r:tt)*) => {let s = {use std::io::Read;let mut s = String::new();std::io::stdin().read_to_string(&mut s).unwrap();s};let mut iter = s.split_whitespace();input_inner!{iter, $($r)*}};}#[macro_export]macro_rules! input_inner {($iter:expr) => {};($iter:expr, ) => {};($iter:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($iter, $t);input_inner!{$iter $($r)*}};}#[macro_export]macro_rules! read_value {($iter:expr, ( $($t:tt),* )) => {( $(read_value!($iter, $t)),* )};($iter:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()};($iter:expr, chars) => {read_value!($iter, String).chars().collect::<Vec<char>>()};($iter:expr, bytes) => {read_value!($iter, String).bytes().collect::<Vec<u8>>()};($iter:expr, usize1) => {read_value!($iter, usize) - 1};($iter:expr, $t:ty) => {$iter.next().unwrap().parse::<$t>().expect("Parse error")};}// ---------- end input macro ----------#[allow(unused)]use std::{io::stderr, io::stdin, io::BufRead, io::Write,mem::swap,cmp::min, cmp::max,cmp::Reverse,collections::HashSet, collections::BTreeSet,collections::HashMap, collections::BTreeMap,collections::BinaryHeap,collections::VecDeque,};