結果
問題 | No.179 塗り分け |
ユーザー |
|
提出日時 | 2019-07-12 17:06:20 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,021 bytes |
コンパイル時間 | 514 ms |
コンパイル使用メモリ | 67,840 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-17 19:50:52 |
合計ジャッジ時間 | 1,722 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 WA * 1 |
other | AC * 26 WA * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:50:27: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized] 50 | if(x == W && y == H) | ~~~~~~~^~~~~~~~~
ソースコード
#include <iostream> #include <vector> #include <queue> #include <algorithm> #include <cstring> #include <math.h> #include <string> using namespace std; int main() { int H, W; cin >> H >> W; int table[51][51]; int cnt = 0; for(int i = 0 ; i < H ; ++i) { string s; cin >> s; for(int j = 0 ; j < W ; ++j) { table[j][i] = s.at(j) == '#' ? 1 : 0; if(table[j][i]) ++cnt; } } if((cnt%2) != 0 || cnt ==0) { cout << "NO"; return 0; } for(int i = -W ; i < W ; ++i)for(int j = -H ; j < H ; ++j) { if(i==0 && j == 0) continue; int m[51][51]; for(int k = 0 ; k < W ; ++k)for(int l = 0 ; l < H ; ++l) { m[k][l] = table[k][l]; } int x, y; for(x = 0 ; x < W ; ++x)for(y = 0 ; y < H ; ++y) { if(m[x][y] != 1) continue; if(x+i < W && y+j < H && x+i >= 0 && y+j >= 0 && m[x+i][y+j] == 1) { m[x][y] = 2;//red m[x+i][y+j] = 3;//blue continue; } break; } if(x == W && y == H) { cout << "YES"; return 0; } } cout << "NO"; return 0; }