結果

問題 No.1000 Point Add and Array Add
ユーザー trineutrontrineutron
提出日時 2020-03-02 17:10:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 868 bytes
コンパイル時間 2,308 ms
コンパイル使用メモリ 199,120 KB
実行使用メモリ 18,048 KB
最終ジャッジ日時 2024-04-21 22:48:03
合計ジャッジ時間 10,822 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 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 1 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 5 ms
5,376 KB
testcase_15 AC 4 ms
5,376 KB
testcase_16 TLE -
testcase_17 AC 1,614 ms
9,088 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

struct query {
    char c;
    int64_t x, y;
};

int main() {
    int n, q;
    cin >> n >> q;
    vector<int64_t> a(n);
    for (int i = 0; i < n; i++) cin >> a.at(i);
    vector<query> v(q);
    for (int i = 0; i < q; i++) cin >> v.at(i).c >> v.at(i).x >> v.at(i).y;
    reverse(v.begin(), v.end());
    vector<int64_t> b(n), count(n);
    for (auto t : v) {
        if (t.c == 'A') {
            b.at(t.x - 1) += count.at(t.x - 1) * t.y;
        } else {
            for (int i = t.x - 1; i < t.y; i++) {
                count.at(i)++;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        b.at(i) += count.at(i) * a.at(i);
    }
    for (int i = 0; i < n; i++) {
        cout << b.at(i);
        if (i < n - 1) {
            cout << " ";
        } else {
            cout << endl;
        }
    }
}
0