Submission #733556

#TimeUsernameProblemLanguageResultExecution timeMemory
733556pccFire (JOI20_ho_t5)C++14
1 / 100
1075 ms3812 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define fs first #define sc second const int mxn = 2e5+10; int arr[mxn]; int n,q; void calc(){ int l,r,t; cin>>t>>l>>r; l--,r--; int tmp[n]; for(int i = 0;i<n;i++)tmp[i] = arr[i]; while(t--){ for(int i = n-2;i>=0;i--){ tmp[i+1] = max(tmp[i+1],tmp[i]); } } ll total = 0; for(int i = l;i<=r;i++)total += tmp[i]; cout<<total<<'\n'; return; } void solve(){ cin>>n>>q; for(int i = 0;i<n;i++)cin>>arr[i]; while(q--)calc(); } int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int t = 1; while(t--)solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...