結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2017-09-17 18:21:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,201 bytes |
コンパイル時間 | 1,750 ms |
コンパイル使用メモリ | 167,568 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 01:56:53 |
合計ジャッジ時間 | 3,255 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 34 WA * 6 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ul; typedef signed long long ll; ul over = 1000000007; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cout << fixed; int h, w; cin >> h >> w; bool isb[h][w]; int cnt = 0; for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { char c; cin >> c; isb[i][j] = (c=='#' ? true : false); if (isb[i][j]) cnt++; } } if (cnt%2==1) {cout << "NO" << endl; return 0;} for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { if (i==0 && j==0) continue; int f_cnt = 0; bool hit[h][w]; for (int k = 0; k < h; ++k) { for (int l = 0; l < w; ++l) hit[k][l] = false; } for (int k = 0; k < h; ++k) { for (int l = 0; l < w; ++l) { if (hit[k][l]) continue; if (isb[k][l] && i+k<h && j+l<w) { if (isb[i+k][j+l]) { f_cnt++; hit[i+k][j+l] = true; } } } } if (f_cnt == cnt/2) { cerr << i << " " << j << endl; cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }