結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2017-01-11 22:10:37 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 811 bytes |
| コンパイル時間 | 225 ms |
| コンパイル使用メモリ | 22,144 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-03 03:32:08 |
| 合計ジャッジ時間 | 2,884 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 WA * 1 |
| other | AC * 25 WA * 2 RE * 13 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d %d", &h, &w);
| ^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdbool.h>
#define rep(i, n) for (i = 0; i < n; i++)
int main() {
int i, j, k, l;
int h, w;
scanf("%d %d", &h, &w);
getchar();
bool s[50][50], f[50][50], f2 = false;
rep(i, h) {
rep(j, w) {
s[i][j] = f[i][j] = (getchar() == '#' ? true : false);
if (!f2 && s[i][j]) f2 = true;
}
getchar();
}
if (!f2) {
puts("NO");
return 0;
}
int dy, dx;
rep(dy, h) rep(dx, w) {
if (dy == 0 && dx == 0) continue;
f2 = true;
rep(i, h) rep(j, w) {
if (!f[i][j]) continue;
int y = i + dy, x = j + dx;
if (!(0 <= y && y <= h && 0 <= x && x <= w) || !f[y][x]) {
rep(k, h) rep(l, w) f[k][l] = s[k][l];
f2 = false;
break;
}
else f[i][j] = f[i + dy][j + dx] = false;
}
if (f2) {
puts("YES");
return 0;
}
}
puts("NO");
return 0;
}
くれちー