This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |