結果
問題 | No.179 塗り分け |
ユーザー | naotoman |
提出日時 | 2020-04-25 20:18:15 |
言語 | Rust (1.77.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,012 bytes |
コンパイル時間 | 16,216 ms |
コンパイル使用メモリ | 379,164 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 18:42:03 |
合計ジャッジ時間 | 17,105 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,248 KB |
testcase_02 | AC | 1 ms
5,248 KB |
testcase_03 | AC | 1 ms
5,248 KB |
testcase_04 | AC | 1 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 1 ms
5,248 KB |
testcase_07 | AC | 16 ms
5,248 KB |
testcase_08 | AC | 16 ms
5,248 KB |
testcase_09 | WA | - |
testcase_10 | AC | 1 ms
5,248 KB |
testcase_11 | AC | 1 ms
5,248 KB |
testcase_12 | AC | 11 ms
5,248 KB |
testcase_13 | AC | 1 ms
5,248 KB |
testcase_14 | AC | 1 ms
5,248 KB |
testcase_15 | AC | 1 ms
5,248 KB |
testcase_16 | AC | 1 ms
5,248 KB |
testcase_17 | AC | 1 ms
5,248 KB |
testcase_18 | AC | 2 ms
5,248 KB |
testcase_19 | AC | 1 ms
5,248 KB |
testcase_20 | AC | 9 ms
5,248 KB |
testcase_21 | AC | 13 ms
5,248 KB |
testcase_22 | AC | 14 ms
5,248 KB |
testcase_23 | AC | 1 ms
5,248 KB |
testcase_24 | AC | 13 ms
5,248 KB |
testcase_25 | AC | 1 ms
5,248 KB |
testcase_26 | WA | - |
testcase_27 | AC | 10 ms
5,248 KB |
testcase_28 | WA | - |
testcase_29 | AC | 10 ms
5,248 KB |
testcase_30 | WA | - |
testcase_31 | AC | 10 ms
5,248 KB |
testcase_32 | AC | 4 ms
5,248 KB |
testcase_33 | AC | 11 ms
5,248 KB |
testcase_34 | WA | - |
testcase_35 | AC | 11 ms
5,248 KB |
testcase_36 | AC | 1 ms
5,248 KB |
testcase_37 | AC | 1 ms
5,248 KB |
testcase_38 | AC | 1 ms
5,248 KB |
testcase_39 | AC | 1 ms
5,248 KB |
testcase_40 | AC | 1 ms
5,248 KB |
testcase_41 | AC | 1 ms
5,248 KB |
testcase_42 | AC | 1 ms
5,248 KB |
testcase_43 | AC | 2 ms
5,248 KB |
testcase_44 | AC | 2 ms
5,248 KB |
testcase_45 | AC | 1 ms
5,248 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::<usize>(); 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 0..h { for dx in 0..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][j] != '#' as u8 { continue; } one = true; let ny = i + dy ; let nx = j + dx; if ny >= h || nx >= w || t[ny][nx] != '#' as u8 { complete = false; break; } t[ny][nx] = 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); } }