結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2021-11-03 17:50:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 93 ms / 3,000 ms |
コード長 | 1,078 bytes |
コンパイル時間 | 5,217 ms |
コンパイル使用メモリ | 253,212 KB |
最終ジャッジ日時 | 2025-01-25 11:10:12 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 40 |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 2000000000 int main(){ int h,w; cin>>h>>w; vector<string> s(h); rep(i,h)cin>>s[i]; if(s==vector<string>(h,string(w,'.'))){ cout<<"NO"<<endl; return 0; } rep(i,h){ rep(j,w){ if(i==0&&j==0)continue; auto ss = s; bool f = true; rep(k,h){ rep(l,w){ if(ss[k][l]=='#'){ if(k+i<h&&j+l<w && ss[k+i][j+l]=='#'){ ss[k+i][j+l] = '.'; } else{ f = false; } } } } if(f){ cout<<"YES"<<endl; return 0; } } } rep(i,h){ rep(j,w){ if(i==0||j==0)continue; auto ss = s; bool f = true; rep(k,h){ rep(l,w){ if(ss[k][l]=='#'){ if(k+i<h&&l-j>=0 && ss[k+i][l-j]=='#'){ ss[k+i][l-j] = '.'; } else{ f = false; } } } } if(f){ cout<<"YES"<<endl; return 0; } } } cout<<"NO"<<endl; return 0; }