結果
問題 | No.870 無敵囲い |
ユーザー | kei |
提出日時 | 2019-08-30 21:57:56 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 300 ms |
コード長 | 4,457 bytes |
コンパイル時間 | 13,984 ms |
コンパイル使用メモリ | 379,828 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 06:18:47 |
合計ジャッジ時間 | 14,411 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 1 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 1 ms
5,376 KB |
testcase_13 | AC | 1 ms
5,376 KB |
testcase_14 | AC | 1 ms
5,376 KB |
testcase_15 | AC | 1 ms
5,376 KB |
testcase_16 | AC | 1 ms
5,376 KB |
testcase_17 | AC | 1 ms
5,376 KB |
testcase_18 | AC | 1 ms
5,376 KB |
testcase_19 | AC | 1 ms
5,376 KB |
testcase_20 | AC | 1 ms
5,376 KB |
コンパイルメッセージ
warning: variable `f1` is assigned to, but never used --> src/main.rs:58:14 | 58 | let (mut f1,mut f2,mut f3) = (false,false,false); | ^^ | = note: consider using `_f1` instead = note: `#[warn(unused_variables)]` on by default warning: variable `f2` is assigned to, but never used --> src/main.rs:58:21 | 58 | let (mut f1,mut f2,mut f3) = (false,false,false); | ^^ | = note: consider using `_f2` instead warning: variable `f3` is assigned to, but never used --> src/main.rs:58:28 | 58 | let (mut f1,mut f2,mut f3) = (false,false,false); | ^^ | = note: consider using `_f3` instead warning: value assigned to `f1` is never read --> src/main.rs:60:54 | 60 | if (2,8) == before[i] && (5,8) == after[i] { f1 = true; cnt1 += 1;} | ^^ | = help: maybe it is overwritten before being read? = note: `#[warn(unused_assignments)]` on by default warning: value assigned to `f2` is never read --> src/main.rs:61:54 | 61 | if (3,9) == before[i] && (4,8) == after[i] { f2 = true; cnt2 += 1;} | ^^ | = help: maybe it is overwritten before being read? warning: value assigned to `f3` is never read --> src/main.rs:62:54 | 62 | if (7,9) == before[i] && (6,8) == after[i] { f3 = true; cnt3 += 1;} | ^^ | = help: maybe it is overwritten before being read?
ソースコード
#![allow(unused_mut, non_snake_case, unused_imports, dead_code,unused_macros)] use std::iter; use std::cmp::{max, min, Ordering}; use std::mem::swap; use std::collections::{HashMap, BTreeMap, HashSet, BTreeSet, BinaryHeap,VecDeque}; use std::iter::FromIterator; // 高速 EOF要 //macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();input_inner!{iter, $($r)*}};($($r:tt)*) => {let mut 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_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_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, usize1) => {read_value!($iter, usize) - 1};($iter:expr, $t:ty) => {$iter.next().unwrap().parse::<$t>().expect("Parse error")};} // 低速 EOF不要 macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};} macro_rules! mut_input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() }; mut_input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()}; mut_input_inner!{next, $($r)*}};} macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};} macro_rules! mut_input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let mut $var = read_value!($next, $t);mut_input_inner!{$next $($r)*}};} macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};} // 非常時 fn read_line() -> String { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); s.trim().to_string() } fn read_vec<T: std::str::FromStr>() -> Vec<T> { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect() } fn solve(){ input!(N:usize,info:[(usize,usize,usize,usize);N]); let info:Vec<(usize,usize,usize,usize)> = info; let mut before = Vec::new(); let mut after = Vec::new(); for i in 0..N{ let idx = after.iter().position(|v| *v == (info[i].0,info[i].1)); if idx == None{ before.push((info[i].0,info[i].1)); after.push((info[i].2,info[i].3)); }else{ let idx = idx.unwrap(); after[idx] = (info[i].2,info[i].3); } } let n = before.len(); let mut cnt1 = 0; let mut cnt2 = 0; let mut cnt3 = 0; let (mut f1,mut f2,mut f3) = (false,false,false); for i in 0..n{ if (2,8) == before[i] && (5,8) == after[i] { f1 = true; cnt1 += 1;} if (3,9) == before[i] && (4,8) == after[i] { f2 = true; cnt2 += 1;} if (7,9) == before[i] && (6,8) == after[i] { f3 = true; cnt3 += 1;} } println!("{}", if cnt1==1 && cnt2==1 && cnt3==1 {"YES"} else {"NO"}); } fn main() { let stack_size = 104_857_600; // 100 MB let thd = std::thread::Builder::new().stack_size(stack_size); thd.spawn(|| solve()).unwrap().join().unwrap(); }