Submission #104971

# Submission time Handle Problem Language Result Execution time Memory
104971 2019-04-10T03:16:52 Z Aydarov03 Divide and conquer (IZhO14_divide) C++14
48 / 100
1000 ms 2552 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int x[100005];
int g[100005];
int e[100005];



main()
{
	int n , ans = 0;
	cin >> n;
	
	for(int i = 1; i <= n; i++)
	{
		cin >> x[i] >> g[i] >> e[i];
	}
	
	int gold = 0 , energy = 0;
	for(int i = 1; i <= n; i++)
	{
		gold = 0 , energy = 0;
		for(int j = i; j <= n; j++)
		{
			gold += g[j];
			energy += e[j];
			if(x[j] - x[i] <= energy)
			{
				ans = max(ans , gold);
			}
		}
	}
	
	cout << ans << endl;
}

Compilation message

divide.cpp:10:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 256 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 21 ms 640 KB Output is correct
12 Correct 18 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 512 KB Output is correct
2 Correct 63 ms 620 KB Output is correct
3 Correct 86 ms 688 KB Output is correct
4 Execution timed out 1065 ms 2552 KB Time limit exceeded
5 Halted 0 ms 0 KB -