#include<bits/stdc++.h>
#include<fstream>
using namespace std;
ifstream fin("VNOICUP.INP");
ofstream fout("VNOICUP.OUT");
#define sz(a) (int)a.size()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
const ld PI = 3.14159265359;
using u128 = __uint128_t;
const int mxn = 1e5 + 5;
int n, k;
ll a[mxn + 1];
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> k;
for(int i = 1; i <= n; i++)cin >> a[i];
int q; cin >> q;
for(int i = 1; i <= q; i++){
int idq; cin >> idq;
if(idq == 1){
for(int j = 0; j < k; j++){
int x; cin >> x;
}
}else{
int l, r, m; cin >> l >> r >> m;
ll ans = 0;
for(int j = l; j <= r; j++){
int low = max(j - m + 1, l), high = min(r - m + 1, j);
ans += 1LL * (high - low + 1) * a[j];
}
cout << ans << "\n";
}
}
return(0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
5 ms |
340 KB |
Output is correct |
4 |
Correct |
10 ms |
440 KB |
Output is correct |
5 |
Correct |
16 ms |
460 KB |
Output is correct |
6 |
Correct |
24 ms |
528 KB |
Output is correct |
7 |
Correct |
35 ms |
536 KB |
Output is correct |
8 |
Correct |
48 ms |
584 KB |
Output is correct |
9 |
Correct |
93 ms |
700 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
382 ms |
1196 KB |
Output is correct |
2 |
Correct |
823 ms |
1740 KB |
Output is correct |
3 |
Correct |
1437 ms |
2104 KB |
Output is correct |
4 |
Execution timed out |
2074 ms |
2600 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1576 ms |
3004 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |