結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2018-07-10 17:28:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 732 bytes |
| コンパイル時間 | 1,795 ms |
| コンパイル使用メモリ | 197,324 KB |
| 最終ジャッジ日時 | 2025-01-06 11:55:31 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 38 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
int H, W; cin>>H>>W;
vector<string> S(H);
int N=0;
for(auto& e: S) {
cin>>e;
N+=count(begin(e), end(e), '#');
}
#define REP(i, a, b) for(int i=a; i<b; ++i)
REP(r, -H, H) REP(c, -W, W) if (c|r) {
auto T=S;
int red=0, blue=0;
REP(i, 0, H) REP(j, 0, W) {
if (!(T[i][j]=='#' && 0<=i+r && i+r<H && 0<=j+c && j+c<W)) continue;
if (T[i][j]==T[i+r][j+c]) {
T[i][j]=0;
T[i+r][j+c]=1;
++red;
++blue;
}
}
if (red==blue && N==red+blue)
return !printf("YES\n");
}
puts("NO");
}
hogeover30