結果
| 問題 | No.179 塗り分け |
| コンテスト | |
| ユーザー |
sntea
|
| 提出日時 | 2015-08-28 21:23:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 3,000 ms |
| コード長 | 1,197 bytes |
| コンパイル時間 | 963 ms |
| コンパイル使用メモリ | 80,708 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-23 14:31:52 |
| 合計ジャッジ時間 | 2,459 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 40 |
ソースコード
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <utility>
#define endl '\n'
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
using namespace std;
char fi[50][50];
typedef pair<int,int> P;
typedef long long int LL;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int H,W;
cin>>H>>W;
REP(i,H) REP(j,W) cin>>fi[i][j];
string ans="NO";
FOR(dh,-H+1,H){
FOR(dw,-W+1,W){
if(dh==0&&dw==0) continue;
int ed[50][50];
REP(i,H) fill(ed[i],ed[i]+W,false);
bool f=true;
bool f2=false;
REP(i,H){
REP(j,W){
if((!ed[i][j])&&fi[i][j]=='#'){
f2=true;
if(!(0<=i+dh&&i+dh<H&&0<=j+dw&&j+dw<W&&fi[i+dh][j+dw]=='#')){
f=false;
break;
}else{
ed[i+dh][j+dw]=true;
}
}
}
}
if(f&&f2){
ans="YES";
break;
}
}
}
cout<<ans<<endl;
return 0;
}
sntea