結果
問題 | No.179 塗り分け |
ユーザー | naotoman |
提出日時 | 2020-04-25 20:23:35 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 53 ms / 3,000 ms |
コード長 | 3,086 bytes |
コンパイル時間 | 12,546 ms |
コンパイル使用メモリ | 392,580 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-23 15:13:32 |
合計ジャッジ時間 | 14,755 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | AC | 1 ms
6,820 KB |
testcase_02 | AC | 1 ms
6,816 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,944 KB |
testcase_05 | AC | 4 ms
6,944 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 53 ms
6,940 KB |
testcase_08 | AC | 53 ms
6,940 KB |
testcase_09 | AC | 52 ms
6,944 KB |
testcase_10 | AC | 22 ms
6,940 KB |
testcase_11 | AC | 20 ms
6,940 KB |
testcase_12 | AC | 36 ms
6,944 KB |
testcase_13 | AC | 1 ms
6,940 KB |
testcase_14 | AC | 1 ms
6,940 KB |
testcase_15 | AC | 0 ms
6,944 KB |
testcase_16 | AC | 1 ms
6,940 KB |
testcase_17 | AC | 1 ms
6,940 KB |
testcase_18 | AC | 16 ms
6,940 KB |
testcase_19 | AC | 16 ms
6,940 KB |
testcase_20 | AC | 29 ms
6,940 KB |
testcase_21 | AC | 44 ms
6,940 KB |
testcase_22 | AC | 48 ms
6,944 KB |
testcase_23 | AC | 21 ms
6,940 KB |
testcase_24 | AC | 45 ms
6,944 KB |
testcase_25 | AC | 24 ms
6,944 KB |
testcase_26 | AC | 19 ms
6,940 KB |
testcase_27 | AC | 34 ms
6,944 KB |
testcase_28 | AC | 16 ms
6,944 KB |
testcase_29 | AC | 33 ms
6,940 KB |
testcase_30 | AC | 25 ms
6,944 KB |
testcase_31 | AC | 30 ms
6,944 KB |
testcase_32 | AC | 23 ms
6,944 KB |
testcase_33 | AC | 33 ms
6,940 KB |
testcase_34 | AC | 19 ms
6,944 KB |
testcase_35 | AC | 34 ms
6,940 KB |
testcase_36 | AC | 1 ms
6,940 KB |
testcase_37 | AC | 1 ms
6,948 KB |
testcase_38 | AC | 1 ms
6,940 KB |
testcase_39 | AC | 1 ms
6,940 KB |
testcase_40 | AC | 1 ms
6,940 KB |
testcase_41 | AC | 1 ms
6,940 KB |
testcase_42 | AC | 1 ms
6,944 KB |
testcase_43 | AC | 2 ms
6,940 KB |
testcase_44 | AC | 5 ms
6,940 KB |
testcase_45 | AC | 1 ms
6,940 KB |
ソースコード
use std::io::{stdin, stdout, StdinLock, StdoutLock, BufReader, BufWriter, BufRead, Write}; fn main() { let (std_in, std_out) = (stdin(), stdout()); let mut io = IO::new(std_in.lock(), std_out.lock()); let tmp = io.rv::<i32>(); let (h, w) = (tmp[0], tmp[1]); let mut tab = Vec::new(); for _ in 0..h { tab.push(io.rb()); } let mut one = false; for dy in -h..h { for dx in -w..w { if dy == 0 && dx == 0 { continue; } let mut complete = true; let mut t = tab.clone(); for i in 0..h { for j in 0..w { if t[i as usize][j as usize] != '#' as u8 { continue; } one = true; let ny = i + dy ; let nx = j + dx; if ny < 0 || nx < 0 || ny >= h || nx >= w || t[ny as usize][nx as usize] != '#' as u8 { complete = false; break; } t[ny as usize][nx as usize] = 0; } } if complete && one { io.w("YES"); return; } } } io.w("NO"); } struct IO<'a> { br: BufReader<StdinLock<'a>>, bw: BufWriter<StdoutLock<'a>>, } #[allow(dead_code)] impl IO<'_> { fn new<'a>(il: StdinLock<'a>, ol: StdoutLock<'a>) -> IO<'a> { IO {br: BufReader::new(il), bw: BufWriter::new(ol) } } fn r<T: std::str::FromStr>(&mut self) -> T { let mut buf = String::new(); self.br.read_line(&mut buf).ok(); buf.trim().parse().ok().unwrap() } fn rb(&mut self) -> Vec<u8> { let mut buf = String::new(); self.br.read_line(&mut buf).ok(); buf.trim().as_bytes().to_vec() } fn rv<T: std::str::FromStr>(&mut self) -> Vec<T> { let mut buf = String::new(); self.br.read_line(&mut buf).ok(); buf.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect() } fn rvb(&mut self) -> Vec<Vec<u8>> { let mut buf = String::new(); self.br.read_line(&mut buf).ok(); buf.trim().split_whitespace().map(|e| e.as_bytes().to_vec()).collect() } fn w<T: std::fmt::Display>(&mut self, x: T) { let _ = writeln!(self.bw, "{}", x); } fn wb(&mut self, s: &[u8]) { let _ = writeln!(self.bw, "{}", unsafe{std::str::from_utf8_unchecked(s)}); } fn wv<T: std::fmt::Display>(&mut self, v: &[T]) { let _ = write!(self.bw, "{}", v[0].to_string()); for x in v[1..].iter() { let _ = write!(self.bw, " {}", x.to_string()); } let _ = writeln!(self.bw); } fn wvb(&mut self, v: &[Vec<u8>]) { let _ = write!(self.bw, "{}", unsafe{std::str::from_utf8_unchecked(&v[0])}); for x in v[1..].iter() { let _ = write!(self.bw, " {}", unsafe{std::str::from_utf8_unchecked(x)}); } let _ = writeln!(self.bw); } }