Submission #39079

# Submission time Handle Problem Language Result Execution time Memory
39079 2018-01-09T08:01:40 Z mrtsima22 Divide and conquer (IZhO14_divide) C++14
48 / 100
1000 ms 6080 KB
#include <bits/stdc++.h>
using namespace std;
#define lo long
lo d[100003],j[100003];
lo g[100003],ans,h[100003];
lo x[100003],n;
int main(){std::ios::sync_with_stdio(false);
//	ifstream cin("devide.in");
//	ofstream cout("devide.out");
cin>>n;
for(lo i=0;i<n;i++)
{
	cin>>x[i]>>g[i]>>d[i];
	j[i]=j[i-1]+d[i];
//	cout<<j[i]<<" ";
	h[i]=h[i-1]+g[i];
//	cout<<h[i]<<endl;
}
for(lo i=0;i<n;i++)
{
	for(lo q=i;q<n;q++)
	{
//		cout<<j[q]<<" "<<j[i]<<" "<<x[q]<<" "<<x[i]<<" +++++"<<endl;
		if(j[q]-j[i-1]>=x[q]-x[i])
		{
			ans=max(ans,h[q]-h[i-1]);
		}
	}
}
cout<<ans<<endl;
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
               *       * *       *
               *        *        *
                *               *
                 *             *
                  *           *
                   *         *
                    *       *
                     *     *
                      *   *
                       * *
                        *



*/


# Verdict Execution time Memory Grader output
1 Correct 0 ms 6080 KB Output is correct
2 Correct 0 ms 6080 KB Output is correct
3 Correct 0 ms 6080 KB Output is correct
4 Correct 0 ms 6080 KB Output is correct
5 Correct 0 ms 6080 KB Output is correct
6 Correct 0 ms 6080 KB Output is correct
7 Correct 0 ms 6080 KB Output is correct
8 Correct 0 ms 6080 KB Output is correct
9 Correct 0 ms 6080 KB Output is correct
10 Correct 0 ms 6080 KB Output is correct
11 Correct 0 ms 6080 KB Output is correct
12 Correct 0 ms 6080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 6080 KB Output is correct
2 Correct 0 ms 6080 KB Output is correct
3 Correct 0 ms 6080 KB Output is correct
4 Correct 0 ms 6080 KB Output is correct
5 Correct 0 ms 6080 KB Output is correct
6 Correct 0 ms 6080 KB Output is correct
7 Correct 0 ms 6080 KB Output is correct
8 Correct 0 ms 6080 KB Output is correct
9 Correct 0 ms 6080 KB Output is correct
10 Correct 3 ms 6080 KB Output is correct
11 Correct 13 ms 6080 KB Output is correct
12 Correct 13 ms 6080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 6080 KB Output is correct
2 Correct 89 ms 6080 KB Output is correct
3 Correct 93 ms 6080 KB Output is correct
4 Execution timed out 1000 ms 6080 KB Execution timed out
5 Halted 0 ms 0 KB -