結果
| 問題 |
No.179 塗り分け
|
| ユーザー |
Lepton_s
|
| 提出日時 | 2015-04-05 23:44:01 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,239 bytes |
| コンパイル時間 | 736 ms |
| コンパイル使用メモリ | 83,932 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-02 13:16:45 |
| 合計ジャッジ時間 | 2,158 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 39 WA * 1 |
ソースコード
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<25;
typedef pair<int,int> P;
typedef long long ll;
typedef unsigned long long ull;
int h, w;
string s[200];
string res[2] = {"NO", "YES"};
bool check(int dx, int dy){
int g[60][60];
for(int i = 0; i < h; i++)
for(int j = 0; j < w; j++)
g[i][j] = s[i][j]=='#';
for(int i = 0; i < h; i++){
for(int j_ = 0; j_ < w; j_++){
int j = dy<0?w-j_-1:j_;
if(g[i][j]){
int i2 = i+dx, j2 = j+dy;
if(i2>=h || j2>=w || j2<0 || !g[i2][j2]) return false;
g[i2][j2] = 0;
}
}
}
return true;
}
int main(){
cin>>h>>w;
for(int i = 0; i < h; i++) cin>>s[i];
bool ok = false;
for(int i = 0; i < h; i++){
for(int j = -w+1; j < w; j++){
if(i==0 && j==0) continue;
if(check(i, j)){
ok = true;
i = h;
break;
}
}
}
cout<<res[ok]<<endl;
return 0;
}
Lepton_s