結果
| 問題 |
No.1000 Point Add and Array Add
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2020-03-02 17:10:37 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 868 bytes |
| コンパイル時間 | 2,438 ms |
| コンパイル使用メモリ | 196,688 KB |
| 最終ジャッジ日時 | 2025-01-09 03:48:21 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 TLE * 6 |
ソースコード
#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;
}
}
}
trineutron