#include <bits/stdc++.h>
#define nikah ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
const ll maxn = 1e5+7;
using namespace std;
ll n,q,k;
ll a[maxn], pref[maxn];
int main() {
nikah
cin>>n>>k;
for (ll i=1; i<=n; i++) {
cin>>a[i];
pref[i] = a[i] + pref[i-1];
}
cin>>q;
while (q--) {
ll mode; cin>>mode;
if (mode == 2) {
ll l,r,m; cin>>l>>r>>m;
ll ans = 0, re = l + m - 1;
while (re <= r) {
ans += (pref[re] - pref[l-1]);
l++; re++;
}
cout<<ans<<endl;
} else {
ll x; cin>>x;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
348 KB |
Output is correct |
4 |
Correct |
6 ms |
604 KB |
Output is correct |
5 |
Correct |
9 ms |
480 KB |
Output is correct |
6 |
Correct |
13 ms |
688 KB |
Output is correct |
7 |
Correct |
20 ms |
604 KB |
Output is correct |
8 |
Correct |
20 ms |
600 KB |
Output is correct |
9 |
Correct |
37 ms |
916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
119 ms |
1468 KB |
Output is correct |
2 |
Correct |
256 ms |
1872 KB |
Output is correct |
3 |
Correct |
480 ms |
2620 KB |
Output is correct |
4 |
Correct |
1726 ms |
4180 KB |
Output is correct |
5 |
Execution timed out |
2021 ms |
4392 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
149 ms |
1872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |