結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2016-07-27 09:55:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 590 bytes |
コンパイル時間 | 134 ms |
コンパイル使用メモリ | 23,296 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-03 03:26:35 |
合計ジャッジ時間 | 1,171 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 6 |
other | WA * 40 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d %d", &h, &w); | ~~~~~^~~~~~~~~~~~~~~~~ main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%s", s+i*w); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> #define N 50 char s[N*N+1], ss[N*N+1]; int main() { int h, w, i, j, dh; scanf("%d %d", &h, &w); for (i = 0; i < h; i++) { scanf("%s", s+i*w); } strcpy(ss, s); for (i = 1; s[i] != '\0'; i++) { dh = i/w; for (j = 0; s[i+j] != '\0'; j++) { if (s[j] == '#') { if ((i+j)/w - j/w != dh) break; s[j] = 'R'; if (s[i+j] != '#') break; s[i+j] = 'B'; } } if (strchr(s, '#') == NULL) { puts("YES\n"); return 0; } strcpy(s, ss); } puts("NO\n"); return 0; }