# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1114984 | AdamGS | Fire (JOI20_ho_t5) | C++17 | 226 ms | 262144 KiB |
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 <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
long long n,q,k,l,p,maks=0;
cin >> n >> q;
vector<long long>c1;
vector<vector<long long>>c3;
for(int i=0;i<n;++i){
cin >> k;
c1.push_back(k);
}
for(int i=0;i<=200;++i){
for(int j=n-1;j>0;--j){
c1[j]=max(c1[j],c1[j-1]);
}
c3.push_back(c1);
}
for(long long i=0;i<q;++i){
cin >> k >> l >>p;
long long suma=0;
for(long long j=l-1;j<p;++j){
//cout << c3[k-1][j] << ' ';
suma +=c3[k-1][j];
}
cout << suma << endl;
}
return 0;
}
Compilation message (stderr)
# | 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... |