Submission #161224

# Submission time Handle Problem Language Result Execution time Memory
161224 2019-11-01T13:24:33 Z MohamedAhmed04 Divide and conquer (IZhO14_divide) C++14
48 / 100
1000 ms 2552 KB
#include <bits/stdc++.h>

using namespace std ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	int n ;
	cin>>n ;
	long long a[n] , e[n] , v[n] ;
	for(int i = 0 ; i < n ; ++i)
		cin>>a[i]>>v[i]>>e[i] ;
	long long ans = 0ll ;
	for(int i = 0 ; i < n ; ++i)
	{
		long long sum1 = 0ll , sum2 = 0ll ;
		for(int j = i ; j < n ; ++j)
		{
			sum1 += e[j] , sum2 += v[j] ;
			if(a[j]-a[i] <= sum1)
				ans = max(ans , sum2) ;
		}
	}
	return cout<<ans<<"\n" , 0 ;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 4 ms 504 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 18 ms 632 KB Output is correct
12 Correct 18 ms 508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 504 KB Output is correct
2 Correct 74 ms 728 KB Output is correct
3 Correct 74 ms 760 KB Output is correct
4 Execution timed out 1074 ms 2552 KB Time limit exceeded
5 Halted 0 ms 0 KB -