結果
問題 | No.1625 三角形の質問 |
ユーザー | akakimidori |
提出日時 | 2021-07-24 02:34:43 |
言語 | Rust (1.77.0 + proconio) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,812 bytes |
コンパイル時間 | 11,911 ms |
コンパイル使用メモリ | 378,236 KB |
実行使用メモリ | 14,208 KB |
最終ジャッジ日時 | 2024-07-19 03:18:44 |
合計ジャッジ時間 | 83,453 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 34 ms
5,376 KB |
testcase_02 | AC | 1,145 ms
7,296 KB |
testcase_03 | AC | 319 ms
7,808 KB |
testcase_04 | AC | 576 ms
6,272 KB |
testcase_05 | AC | 1,707 ms
10,368 KB |
testcase_06 | AC | 5,189 ms
14,080 KB |
testcase_07 | AC | 5,162 ms
14,080 KB |
testcase_08 | AC | 5,207 ms
14,080 KB |
testcase_09 | AC | 5,260 ms
14,080 KB |
testcase_10 | AC | 5,010 ms
14,080 KB |
testcase_11 | AC | 5,132 ms
14,208 KB |
testcase_12 | AC | 5,176 ms
14,080 KB |
testcase_13 | AC | 5,316 ms
14,080 KB |
testcase_14 | AC | 5,211 ms
14,080 KB |
testcase_15 | AC | 5,131 ms
14,080 KB |
testcase_16 | TLE | - |
testcase_17 | AC | 38 ms
9,728 KB |
testcase_18 | TLE | - |
testcase_19 | -- | - |
ソースコード
// ---------- begin scannner ---------- #[allow(dead_code)] mod scanner { use std::str::FromStr; pub struct Scanner<'a> { it: std::str::SplitWhitespace<'a>, } impl<'a> Scanner<'a> { pub fn new(s: &'a String) -> Scanner<'a> { Scanner { it: s.split_whitespace(), } } pub fn next<T: FromStr>(&mut self) -> T { self.it.next().unwrap().parse::<T>().ok().unwrap() } pub fn next_bytes(&mut self) -> Vec<u8> { self.it.next().unwrap().bytes().collect() } pub fn next_chars(&mut self) -> Vec<char> { self.it.next().unwrap().chars().collect() } pub fn next_vec<T: FromStr>(&mut self, len: usize) -> Vec<T> { (0..len).map(|_| self.next()).collect() } } } // ---------- end scannner ---------- use std::io::Write; fn main() { use std::io::Read; let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); let mut sc = scanner::Scanner::new(&s); let out = std::io::stdout(); let mut out = std::io::BufWriter::new(out.lock()); unsafe { run(&mut sc, &mut out); } } #[target_feature(enable = "avx2")] unsafe fn run<W: Write>(sc: &mut scanner::Scanner, out: &mut std::io::BufWriter<W>) { let n: usize = sc.next(); let q: usize = sc.next(); let mut l = vec![0i32; n]; let mut r = vec![0i32; n]; let mut s = vec![0i64; n]; for ((l, r), s) in l.iter_mut().zip(r.iter_mut()).zip(s.iter_mut()) { let a = sc.next::<i32>(); let b = sc.next::<i32>(); let c = sc.next::<i32>(); let d = sc.next::<i32>(); let e = sc.next::<i32>(); let f = sc.next::<i32>(); *l = a.min(c).min(e); *r = a.max(c).max(e); let c = c - a; let d = d - b; let e = e - a; let f = f - b; *s = (c as i64 * f as i64 - d as i64 * e as i64).abs(); } for _ in 0..q { let op: u8 = sc.next(); if op == 1 { let a = sc.next::<i32>(); let b = sc.next::<i32>(); let c = sc.next::<i32>(); let d = sc.next::<i32>(); let e = sc.next::<i32>(); let f = sc.next::<i32>(); l.push(a.min(c).min(e)); r.push(a.max(c).max(e)); let c = c - a; let d = d - b; let e = e - a; let f = f - b; s.push((c as i64 * f as i64 - d as i64 * e as i64).abs()); } else { let x = sc.next::<i32>(); let y = sc.next::<i32>(); let ans = l.iter().zip(&r).zip(&s).filter(|((l, r), _)| x <= **l && **r <= y).map(|p| *p.1).max().unwrap_or(-1); writeln!(out, "{}", ans).ok(); } } }