# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
583764 |
2022-06-26T07:42:20 Z |
Ivkosqn |
Addk (eJOI21_addk) |
C++14 |
|
49 ms |
5944 KB |
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int maxn = 1e5 + 1;
int n, k, a[maxn];
unsigned long long p[maxn], pref[maxn];
void solve(){
int q;
cin >> q;
while(q--){
int type;
cin >> type;
if(type == 1){
for(int i = 0;i < k;i++){
int a;
cin >> a;
}
continue;
}
int l, r, m;
cin >> l >> r >> m;
unsigned long long ans = 0;
ans = pref[r] - pref[l + m - 2];
ans = ans - (pref[r - m] - pref[max(0, l - 2)]);
cout << ans << endl;
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
for(int i = 1;i <= n;i++){
cin >> a[i];
p[i] = p[i - 1] + a[i];
}
for(int i = 1;i <= n;i++){
pref[i] = pref[i - 1] + p[i];
}
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
3 ms |
468 KB |
Output is correct |
7 |
Correct |
4 ms |
476 KB |
Output is correct |
8 |
Correct |
4 ms |
468 KB |
Output is correct |
9 |
Correct |
5 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
1108 KB |
Output is correct |
2 |
Correct |
14 ms |
1308 KB |
Output is correct |
3 |
Correct |
19 ms |
1580 KB |
Output is correct |
4 |
Correct |
30 ms |
2704 KB |
Output is correct |
5 |
Correct |
49 ms |
4240 KB |
Output is correct |
6 |
Correct |
43 ms |
5944 KB |
Output is correct |
7 |
Correct |
45 ms |
5940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
1808 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |