結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2023-01-14 20:06:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,206 bytes |
コンパイル時間 | 2,180 ms |
コンパイル使用メモリ | 172,024 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 05:40:58 |
合計ジャッジ時間 | 4,125 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 34 WA * 6 |
ソースコード
#include<bits/stdc++.h> using namespace std; bool checkDyDx(int h, int w, int dy, int dx, vector<string> m) { int i, j; for(i=0; i<h; i++) { for(j=0; j<w; j++) { if(m[i][j] == '#') { if(i+dy < h && j+dx < w && m[i+dy][j+dx] == '#') { m[i][j] = '.'; m[i+dy][j+dx] = '.'; }else { //this dx, dy is not answer return false; } } } } return true; } int main() { int h, w; cin >> h >> w; int i; vector<string> vs; string bufstr; for(i=0; i<h; i++) { cin >> bufstr; vs.push_back(bufstr); } int j; /* for(i=0; i<h; i++) { for(j=0; j<w; j++) { cout << vs[i][j]; } cout << endl; } */ int dx, dy; bool ans; for(dy=0; dy<h; dy++) { for(dx=0; dx<w; dx++) { if(dy==0 && dx==0) { continue; } if(checkDyDx(h, w, dy, dx, vs)) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }