結果

問題 No.230 Splarraay スプラレェーイ
ユーザー カルロスカルロス
提出日時 2015-09-23 10:07:10
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,361 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 24,628 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-26 14:35:02
合計ジャッジ時間 9,574 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>



int main(void){
    int i, j, N, Q, x, l, r, c1, c2, score_1 = 0, score_2 = 0;
    int field[100000] = {0};
    scanf("%d %d", &N, &Q);
    for(i=0;i<Q;i++){
        scanf("%d %d %d", &x, &l, &r);
        if(x==0){
            c1 = 0, c2 = 0;
            for(j=l;j<=r;j++){
                if      (field[j]==1){
                    c1++;
                }else if(field[j]==2){
                    c2++;
                }
            }
            if      (c1>c2){
                score_1 += c1;
            }else if(c1<c2){
                score_2 += c2;
            }
        }else if(x==1){
            for(j=l;j<=r;j++){
                if      (field[j]==0){
                    field[j] = 1;
                    score_1++;
                }else if(field[j]==2){
                    field[j] = 1;
                    score_1++;
                    score_2--;
                }
            }
        }else{
            for(j=l;j<=r;j++){
                if      (field[j]==0){
                    field[j] = 2;
                    score_2++;
                }else if(field[j]==1){
                    field[j] = 2;
                    score_1--;
                    score_2++;
                }
            }
        }
        printf("1 = %d, 2 = %d\n", score_1, score_2);
    }
    printf("%d %d\n", score_1, score_2);
    return 0;
}
0