0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-05 09:18:47 +00:00
OI-codes/Luogu/P1438/P1438.cpp

26 lines
512 B
C++
Raw Normal View History

2021-07-05 07:02:37 +00:00
#include <bits/stdc++.h>
using namespace std;
int n, m, op, l, r, k, d, p, a[100005];
int main() {
cin >> n >> m;
2021-11-19 09:01:13 +00:00
for (int i = 1; i <= n; i++) {
2021-07-05 07:02:37 +00:00
cin >> a[i];
}
2021-11-19 09:01:13 +00:00
for (int i = 0; i < m; i++) {
2021-07-05 07:02:37 +00:00
cin >> op;
2021-11-19 09:01:13 +00:00
if (op == 1) {
2021-07-05 07:02:37 +00:00
cin >> l >> r >> k >> d;
2021-11-19 09:01:13 +00:00
for (int j = l; j <= r; j++) {
2021-07-05 07:02:37 +00:00
a[j] += k + (j - l) * d;
}
2021-11-19 09:01:13 +00:00
} else if (op == 2) {
2021-07-05 07:02:37 +00:00
cin >> p;
cout << a[p] << endl;
}
}
return 0;
}