結果

問題 No.1000 Point Add and Array Add
ユーザー tsutajtsutaj
提出日時 2020-02-24 01:25:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 647 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 52,408 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-04-19 08:33:36
合計ジャッジ時間 4,567 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 4 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <cstdio>
#include <algorithm>
using namespace std;
using ll = long long int;

int main() {
    int N, Q; scanf("%d%d", &N, &Q);
    vector<ll> A(N), B(N);
    for(int i=0; i<N; i++) scanf("%lld", &A[i]);
    while(Q--) {
        char c; scanf(" %c ", &c);
        int t = (c == 'A' ? 1 : 2);
        if(t == 1) {
            ll k, x; scanf("%lld%lld", &k, &x); k--;
            A[k] += x;
        }
        if(t == 2) {
            int l, r; scanf("%d%d", &l, &r); l--;
            for(int i=l; i<r; i++) B[i] += A[i];
        }
    }
    for(int i=0; i<N; i++) printf("%lld%c", B[i], " \n"[i + 1 == N]);
    return 0;
}
0