#include <iostream>
using namespace std;
int tr[200000];
int akttr[200000];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,q;
cin >> n >> q;
for (int i=0; i<n; i++){
cin >> tr[i];
}
for (int i=0; i<q; i++){
int t,l,r,wyn=0;
for (int i=0; i<n; i++) akttr[i]=tr[i];
cin >> t >> l >> r;
for (int k=0; k<t; k++){
for (int j=n-1; j; j--){
akttr[j]=max(akttr[j],akttr[j-1]);
}
}
for (int k=l-1; k<r; k++){
//cout << akttr[k] << ' ';
wyn+=akttr[k];
}
cout << wyn << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
3 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Execution timed out |
1024 ms |
3000 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Execution timed out |
1038 ms |
2640 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1028 ms |
2128 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
3 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |