結果
| 問題 |
No.348 カゴメカゴメ
|
| コンテスト | |
| ユーザー |
MoritaYasuaki
|
| 提出日時 | 2016-03-05 04:41:42 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,116 bytes |
| コンパイル時間 | 350 ms |
| コンパイル使用メモリ | 20,736 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 14:13:21 |
| 合計ジャッジ時間 | 1,864 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 WA * 34 |
コンパイルメッセージ
main.c:7:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
7 | main(){
| ^~~~
main.c: In function ‘main’:
main.c:8:5: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
8 | scanf("%d%d",&N,&M);
| ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
+++ |+#include <stdio.h>
1 | int N,M;
main.c:8:5: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
8 | scanf("%d%d",&N,&M);
| ^~~~~
main.c:8:5: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:12:9: warning: implicit declaration of function ‘getchar’ [-Wimplicit-function-declaration]
12 | getchar();
| ^~~~~~~
main.c:12:9: note: ‘getchar’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’?
main.c:43:5: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
43 | printf("%ld\n", S[0]>=S[1]?S[0]:S[1]);
| ^~~~~~
main.c:43:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:43:5: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
main.c:43:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
ソースコード
int N,M;
long S[2] = {0};
char e[1003] = {0};
#define X(x) ((x)&0x1)
#define COLOR(x) ((x)&0x10)
main(){
scanf("%d%d",&N,&M);
for (int n = 0; n < N; n++) {
char ul = 0;
char l = 0;
getchar();
for (int m = 0; m < M; m++) {
char c = getchar() != '.';
char u = e[m+1];
char ur = e[m+2];
if (!X(c))
if (!X(u))
c = u;
else if (!X(l))
c = l;
else if (!X(ul))
c = ul ^ 0x10;
else
c = COLOR(l);
else
if (!X(u) && !X(l) && !X(ul) && !X(ur))
c = COLOR(l) | c;
else if (X(u))
c = u;
else if (X(l))
c = l;
else if (X(ul))
c = ul;
else
c = ur;
S[!!COLOR(c)] += X(c);
e[m+1] = c;
l = c;
ul = u;
}
}
printf("%ld\n", S[0]>=S[1]?S[0]:S[1]);
}
MoritaYasuaki