結果
問題 | No.348 カゴメカゴメ |
ユーザー | MoritaYasuaki |
提出日時 | 2016-03-05 04:41:42 |
言語 | C90 (gcc 11.4.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 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 6 ms
6,812 KB |
testcase_01 | WA | - |
testcase_02 | AC | 6 ms
6,940 KB |
testcase_03 | AC | 6 ms
6,940 KB |
testcase_04 | AC | 0 ms
6,944 KB |
testcase_05 | AC | 0 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | AC | 1 ms
6,940 KB |
testcase_09 | AC | 1 ms
6,944 KB |
testcase_10 | AC | 1 ms
6,940 KB |
testcase_11 | AC | 1 ms
6,944 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 6 ms
6,944 KB |
testcase_16 | AC | 1 ms
6,944 KB |
testcase_17 | AC | 1 ms
6,944 KB |
testcase_18 | AC | 0 ms
6,940 KB |
testcase_19 | AC | 1 ms
6,944 KB |
testcase_20 | AC | 0 ms
6,944 KB |
testcase_21 | AC | 1 ms
6,940 KB |
testcase_22 | AC | 1 ms
6,944 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
コンパイルメッセージ
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]); }