QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#141684 | #6857. Easy problem II | neko_nyaa | AC ✓ | 879ms | 3848kb | C++23 | 600b | 2023-08-17 21:00:43 | 2023-08-17 21:00:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18;
signed main() {
ios::sync_with_stdio(0); cin.tie(0);
int ts, n, m; cin >> ts >> n >> m;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
while (m--) {
int t, l, r; cin >> t >> l >> r; l--;
if (t == 1) {
int x; cin >> x;
for (int i = l; i < r; i++) {
if (a[i] < x) a[i] = x-a[i];
else a[i] = x+a[i];
}
} else {
int ans = 0;
for (int i = l; i < r; i++) {
ans += a[i];
}
cout << ans << '\n';
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 879ms
memory: 3848kb
input:
1 100000 100000 9994250 1 9999152 1 9996205 1 9993920 1 9992936 1 9999312 1 9994863 1 9999950 1 9994702 1 9998302 1 9997460 1 9995584 1 9990858 1 9995764 1 9992400 1 9992970 1 9993486 1 9992200 1 9991250 1 9990336 1 9994212 1 9992704 1 9999400 1 9994826 1 9996272 1 9995920 1 9994960 1 9996400 1 9990...
output:
474104664177 469903014249 480933011291 483822399944 484396591822 485195157450 476873328231 500050522935 490495899612 455001143708 459350186600 463088605817 452789422852 457530804729 478921256445 483860248443 460953094343 461203887676 471567676461 499102979676 483610787357 490750641096 468023668995 4...
result:
ok 85563 lines