Submission #104970

# Submission time Handle Problem Language Result Execution time Memory
104970 2019-04-10T03:15:44 Z Aydarov03 Divide and conquer (IZhO14_divide) C++14
17 / 100
80 ms 652 KB
#include <bits/stdc++.h>
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:9:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 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 0 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 512 KB Output is correct
12 Correct 3 ms 384 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 3 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Incorrect 4 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 532 KB Output is correct
2 Correct 80 ms 652 KB Output is correct
3 Incorrect 70 ms 640 KB Output isn't correct
4 Halted 0 ms 0 KB -