結果

問題 No.348 カゴメカゴメ
ユーザー MoritaYasuakiMoritaYasuaki
提出日時 2016-03-05 04:43:25
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,160 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 21,872 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 19:50:46
合計ジャッジ時間 1,584 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 6 ms
4,348 KB
testcase_03 AC 6 ms
4,348 KB
testcase_04 AC 0 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 0 ms
4,348 KB
testcase_10 AC 0 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 6 ms
4,348 KB
testcase_16 AC 0 ms
4,348 KB
testcase_17 AC 0 ms
4,348 KB
testcase_18 AC 0 ms
4,348 KB
testcase_19 AC 0 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 0 ms
4,348 KB
testcase_22 AC 1 ms
4,348 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:9:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    9 | main(){
      | ^~~~
main.c: In function ‘main’:
main.c:10:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |     scanf("%d%d",&N,&M);
      |     ^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
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);
    int n,m;
    for (n = 0; n < N; n++) {
        char ul = 0;
        char l = 0;
        getchar();
        for (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]);
}
0