結果

問題 No.469 区間加算と一致検索の問題
ユーザー CinnamonCinnamon
提出日時 2017-05-06 17:13:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,169 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 53,000 KB
実行使用メモリ 811,260 KB
最終ジャッジ日時 2023-10-12 15:11:30
合計ジャッジ時間 4,130 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 MLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main() {
    int N, Q;
    cin >> N >> Q;
    int x[Q + 1][N];
    for (int k = 0; k < N; k++) {
            x[0][k] = 0;
    }
    char s[Q];
    int L[Q], R[Q], K[Q];
    for (int i = 0; i < Q; i++){
        cin >> s[i];
        if (s[i] == '!') {
             cin >> L[i] >> R[i] >> K[i];
             for (int j = L[i]; j < R[i]; j++){
                x[i][j] = x[i - 1][j] + K[i];
             }
        }else{
            for (int k = 0; k < N; k++)
            if(i == 0){
                x[1][k] = x[0][k];
            }else{
                x[i][k] = x[i-1][k];
            }
            int answer = 0;
            
            for (int z = 0; z < Q ;z++) {
                for (int y = 0; y < N; y++) {
                    if (x[i][y] == x[z][y]) {
                    	if(x[i][N] == x[z][N]){
                    		break;
                    	}
                        continue;
                    }else{
                        goto lo;
                    }
                }
                lo:
                    answer++;
            }
            cout << answer << endl;
        }
    }

    return 0;
}
0