結果
| 問題 | No.179 塗り分け |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-15 03:27:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 3,000 ms |
| コード長 | 611 bytes |
| コンパイル時間 | 688 ms |
| コンパイル使用メモリ | 65,920 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-23 14:48:43 |
| 合計ジャッジ時間 | 2,093 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 40 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
int h,w;
string s[50];
main()
{
cin>>h>>w;
for(int i=0;i<h;i++)cin>>s[i];
for(int i=0;i<h;i++)for(int j=-w;j<w;j++)
{
if(!i&&!j)continue;
bool used[50][50]={};
bool flag=1;
int cnt=0;
for(int x=0;flag&&x+i<h;x++)for(int y=j<0?-j:0;flag&&y<w&&y+j<w;y++)
{
if(used[x][y]||s[x][y]=='.')continue;
if(used[x+i][y+j])flag=0;
used[x][y]=used[x+i][y+j]=1;
cnt++;
if(s[x+i][y+j]=='.')flag=0;
}
for(int x=0;x<h;x++)for(int y=0;y<w;y++)flag&=s[x][y]=='.'||used[x][y];
if(flag&&cnt>0)
{
cout<<"YES"<<endl;return 0;
}
}cout<<"NO"<<endl;
}