Submission #733556

# Submission time Handle Problem Language Result Execution time Memory
733556 2023-05-01T03:12:49 Z pcc Fire (JOI20_ho_t5) C++14
1 / 100
1000 ms 3812 KB
#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 time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 4 ms 328 KB Output is correct
5 Correct 4 ms 328 KB Output is correct
6 Correct 4 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 7 ms 328 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 4 ms 328 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 13 ms 340 KB Output is correct
14 Correct 7 ms 212 KB Output is correct
15 Correct 12 ms 340 KB Output is correct
16 Correct 6 ms 340 KB Output is correct
17 Correct 8 ms 340 KB Output is correct
18 Correct 8 ms 340 KB Output is correct
19 Correct 7 ms 340 KB Output is correct
20 Correct 7 ms 340 KB Output is correct
21 Correct 11 ms 348 KB Output is correct
22 Correct 7 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 328 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 1075 ms 3812 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 1052 ms 3780 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 2372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 4 ms 328 KB Output is correct
5 Correct 4 ms 328 KB Output is correct
6 Correct 4 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 7 ms 328 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 4 ms 328 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 13 ms 340 KB Output is correct
14 Correct 7 ms 212 KB Output is correct
15 Correct 12 ms 340 KB Output is correct
16 Correct 6 ms 340 KB Output is correct
17 Correct 8 ms 340 KB Output is correct
18 Correct 8 ms 340 KB Output is correct
19 Correct 7 ms 340 KB Output is correct
20 Correct 7 ms 340 KB Output is correct
21 Correct 11 ms 348 KB Output is correct
22 Correct 7 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 328 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Execution timed out 1075 ms 3812 KB Time limit exceeded
34 Halted 0 ms 0 KB -