結果
問題 | No.179 塗り分け |
ユーザー | kei |
提出日時 | 2018-09-08 13:12:46 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 16 ms / 3,000 ms |
コード長 | 3,873 bytes |
コンパイル時間 | 13,647 ms |
コンパイル使用メモリ | 386,228 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 14:52:55 |
合計ジャッジ時間 | 14,745 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,816 KB |
testcase_02 | AC | 1 ms
6,940 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | AC | 13 ms
6,944 KB |
testcase_09 | AC | 13 ms
6,940 KB |
testcase_10 | AC | 1 ms
6,944 KB |
testcase_11 | AC | 1 ms
6,940 KB |
testcase_12 | AC | 12 ms
6,940 KB |
testcase_13 | AC | 1 ms
6,944 KB |
testcase_14 | AC | 1 ms
6,940 KB |
testcase_15 | AC | 1 ms
6,944 KB |
testcase_16 | AC | 1 ms
6,944 KB |
testcase_17 | AC | 1 ms
6,940 KB |
testcase_18 | AC | 1 ms
6,944 KB |
testcase_19 | AC | 2 ms
6,940 KB |
testcase_20 | AC | 12 ms
6,944 KB |
testcase_21 | AC | 14 ms
6,944 KB |
testcase_22 | AC | 16 ms
6,940 KB |
testcase_23 | AC | 1 ms
6,940 KB |
testcase_24 | AC | 13 ms
6,944 KB |
testcase_25 | AC | 1 ms
6,944 KB |
testcase_26 | AC | 3 ms
6,944 KB |
testcase_27 | AC | 13 ms
6,940 KB |
testcase_28 | AC | 2 ms
6,944 KB |
testcase_29 | AC | 14 ms
6,940 KB |
testcase_30 | AC | 5 ms
6,944 KB |
testcase_31 | AC | 13 ms
6,940 KB |
testcase_32 | AC | 5 ms
6,944 KB |
testcase_33 | AC | 13 ms
6,944 KB |
testcase_34 | AC | 3 ms
6,940 KB |
testcase_35 | AC | 13 ms
6,940 KB |
testcase_36 | AC | 1 ms
6,944 KB |
testcase_37 | AC | 1 ms
6,944 KB |
testcase_38 | AC | 1 ms
6,944 KB |
testcase_39 | AC | 1 ms
6,944 KB |
testcase_40 | AC | 1 ms
6,940 KB |
testcase_41 | AC | 1 ms
6,944 KB |
testcase_42 | AC | 1 ms
6,944 KB |
testcase_43 | AC | 1 ms
6,940 KB |
testcase_44 | AC | 2 ms
6,940 KB |
testcase_45 | AC | 1 ms
6,940 KB |
ソースコード
#![allow(unused_mut, non_snake_case, unused_macros)] // 高速 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! 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! 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")};} /* <url:https://yukicoder.me/problems/no/179> 問題文============================================================ ================================================================= 解説============================================================= ================================================================ */ fn main() { input! {H:usize,W:usize,S: [chars; H]} let H: usize = H; let W: usize = W; let S: Vec<Vec<char>> = S; if !S.iter().any(|v| v.iter().any(|&c| c=='#')){ println!("NO"); return; } let mut flag = false; 'solver:for sita in 0..H as i32 { for migi in -(W as i32)..W as i32 { if sita == 0 && migi == 0{ continue; } let mut ok = true; let mut checked = S.clone(); 'check: for h in 0..H as i32 { for w in 0..W as i32 { if checked[h as usize][w as usize] != '#'{ continue; } if (h as i32+sita>=0)&&(w as i32 +migi>=0)&&(h as i32 + sita < H as i32) && (w as i32 + migi < W as i32){ if checked[(h+sita)as usize][(w+migi) as usize] == '#'{ checked[h as usize][w as usize] = '@'; checked[(h+sita) as usize][(w+migi) as usize] = '@'; }else{ ok = false; break 'check; } }else{ ok = false; break 'check; } } } if ok{ flag = true; break 'solver; } } } println!("{}",if flag{"YES"}else{"NO"}); }