Submission #17453

# Submission time Handle Problem Language Result Execution time Memory
17453 2015-12-13T14:50:22 Z azecoder Divide and conquer (IZhO14_divide) C++
48 / 100
1000 ms 4060 KB
#include <iostream>

#define MAXN 100005
#define intt long long

using namespace std ;

intt n , gold[MAXN] , en[MAXN] , ans , x[MAXN] ;

int main () {
	
	cin >> n ;
	
	for ( int i = 1 ; i <= n ; i ++ ) {
		
		cin >> x[i] >> gold[i] >> en[i] ;
		
		gold[i] += gold[i - 1] ;
		
		en[i] += en[i - 1] ;
				
	}
	
	for ( int i = 1 ; i <= n ; i ++ ) {
		
		for ( int j = i ; j <= n ; j ++ ) {
			
			if ( en[j] - en[i - 1] >= x[j] - x[i] ) ans = max ( ans , gold[j] - gold[i - 1] ) ;
				
		}
			
	}
	
	cout << ans << endl ;
	
	return 0 ;
		
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4060 KB Output is correct
2 Correct 0 ms 4060 KB Output is correct
3 Correct 0 ms 4060 KB Output is correct
4 Correct 0 ms 4060 KB Output is correct
5 Correct 0 ms 4060 KB Output is correct
6 Correct 0 ms 4060 KB Output is correct
7 Correct 0 ms 4060 KB Output is correct
8 Correct 0 ms 4060 KB Output is correct
9 Correct 0 ms 4060 KB Output is correct
10 Correct 0 ms 4060 KB Output is correct
11 Correct 0 ms 4060 KB Output is correct
12 Correct 0 ms 4060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4060 KB Output is correct
2 Correct 0 ms 4060 KB Output is correct
3 Correct 0 ms 4060 KB Output is correct
4 Correct 0 ms 4060 KB Output is correct
5 Correct 2 ms 4060 KB Output is correct
6 Correct 4 ms 4060 KB Output is correct
7 Correct 0 ms 4060 KB Output is correct
8 Correct 3 ms 4060 KB Output is correct
9 Correct 4 ms 4060 KB Output is correct
10 Correct 5 ms 4060 KB Output is correct
11 Correct 25 ms 4060 KB Output is correct
12 Correct 25 ms 4060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 4060 KB Output is correct
2 Correct 125 ms 4060 KB Output is correct
3 Correct 132 ms 4060 KB Output is correct
4 Execution timed out 1000 ms 4056 KB Program timed out
5 Halted 0 ms 0 KB -