Submission #490680

# Submission time Handle Problem Language Result Execution time Memory
490680 2021-11-28T16:05:31 Z irmuun Divide and conquer (IZhO14_divide) C++17
48 / 100
1000 ms 3500 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll n,x[100001],g[100001],d[100001],i,j,e,m,l,r,ans;
	cin>>n;
	ans=0;
	for(i=1;i<=n;i++){
		cin>>x[i]>>g[i]>>d[i];
		if(d[i]>0){
			ans=max(ans,g[i]);
		}
	}
	for(i=1;i<=n;i++){
		e=d[i];
		m=g[i];
		l=x[i]-1;
		r=x[i];
		for(j=i+1;j<=n;j++){
			r=x[j];
			e+=d[j];
			m+=g[j];
			if(e>=r-l){
				ans=max(ans,m);
			}
		}
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 1 ms 2636 KB Output is correct
3 Correct 1 ms 2636 KB Output is correct
4 Correct 1 ms 2636 KB Output is correct
5 Correct 2 ms 2636 KB Output is correct
6 Correct 2 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 2 ms 2636 KB Output is correct
9 Correct 1 ms 2636 KB Output is correct
10 Correct 2 ms 2636 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 1 ms 2636 KB Output is correct
3 Correct 1 ms 2636 KB Output is correct
4 Correct 1 ms 2636 KB Output is correct
5 Correct 2 ms 2636 KB Output is correct
6 Correct 2 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 2 ms 2636 KB Output is correct
9 Correct 1 ms 2636 KB Output is correct
10 Correct 2 ms 2636 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 2 ms 2640 KB Output is correct
14 Correct 2 ms 2616 KB Output is correct
15 Correct 2 ms 2636 KB Output is correct
16 Correct 2 ms 2636 KB Output is correct
17 Correct 3 ms 2644 KB Output is correct
18 Correct 3 ms 2636 KB Output is correct
19 Correct 3 ms 2636 KB Output is correct
20 Correct 3 ms 2636 KB Output is correct
21 Correct 3 ms 2636 KB Output is correct
22 Correct 4 ms 2636 KB Output is correct
23 Correct 16 ms 2636 KB Output is correct
24 Correct 17 ms 2636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 1 ms 2636 KB Output is correct
3 Correct 1 ms 2636 KB Output is correct
4 Correct 1 ms 2636 KB Output is correct
5 Correct 2 ms 2636 KB Output is correct
6 Correct 2 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 2 ms 2636 KB Output is correct
9 Correct 1 ms 2636 KB Output is correct
10 Correct 2 ms 2636 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 2 ms 2640 KB Output is correct
14 Correct 2 ms 2616 KB Output is correct
15 Correct 2 ms 2636 KB Output is correct
16 Correct 2 ms 2636 KB Output is correct
17 Correct 3 ms 2644 KB Output is correct
18 Correct 3 ms 2636 KB Output is correct
19 Correct 3 ms 2636 KB Output is correct
20 Correct 3 ms 2636 KB Output is correct
21 Correct 3 ms 2636 KB Output is correct
22 Correct 4 ms 2636 KB Output is correct
23 Correct 16 ms 2636 KB Output is correct
24 Correct 17 ms 2636 KB Output is correct
25 Correct 21 ms 2636 KB Output is correct
26 Correct 62 ms 2728 KB Output is correct
27 Correct 59 ms 2812 KB Output is correct
28 Execution timed out 1083 ms 3500 KB Time limit exceeded
29 Halted 0 ms 0 KB -