結果
| 問題 | No.179 塗り分け |
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-04-08 22:43:37 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 109 ms / 3,000 ms |
| コード長 | 1,329 bytes |
| 記録 | |
| コンパイル時間 | 493 ms |
| コンパイル使用メモリ | 94,712 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-03 14:43:32 |
| 合計ジャッジ時間 | 2,440 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge5_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 40 |
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
using namespace std;
typedef long long ll;
char in[50][51];
int h,w;
bool check(int x,int y){
bool kaku[50][50] = {0};
int c=0;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(!kaku[i][j] && in[i][j]=='#'){
if(0<=h && 0<=w && i+y<h && j+x<w && in[i+y][j+x]=='#' && kaku[i+y][j+x]==false){
kaku[i+y][j+x]=true;
kaku[i][j]=true;
c++;
}
}
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(in[i][j]=='#' && !kaku[i][j]){
return false;
}
}
}
if(c==0) return false;
return true;
}
int main(){
scanf("%d%d",&h,&w);
for(int i=0;i<h;i++){
scanf("%s",in[i]);
}
for(int i=-w+1;i<w;i++){
for(int j=-h+1;j<h;j++){
if(i==0 && j==0) continue;
if(check(i,j)){
puts("YES");
return 0;
}
}
}
puts("NO");
return 0;
}
goodbaton