Submission #86755

# Submission time Handle Problem Language Result Execution time Memory
86755 2018-11-27T09:26:22 Z duy_tran Divide and conquer (IZhO14_divide) C++14
0 / 100
1000 ms 3436 KB
#include<bits/stdc++.h>
using namespace std;

const int maxn=(int)1e5+50;
int n,x[maxn];
long long gold[maxn],energy[maxn],a[maxn];

int main()
{
    cin>>n;

    for(int i=1;i<=n;++i)
    {
        long long g,d;
        cin>>x[i]>>g>>d;

        gold[i]=gold[i-1]+g;
        energy[i]=energy[i-1]+d;
        a[i]=energy[i]-x[i];
    }

    long long Max=0;

    for(int i=1;i<=n;++i)
    {
        for(int j=0;j<=i;++j)
        {
            if(a[i]>=a[j])
            {
                Max=max(Max,gold[i]-gold[j-1]);
                break;
            }
        }
    }

    cout<<Max;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 448 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Incorrect 2 ms 544 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 672 KB Output is correct
2 Correct 10 ms 800 KB Output is correct
3 Correct 13 ms 800 KB Output is correct
4 Correct 67 ms 1900 KB Output is correct
5 Correct 70 ms 1900 KB Output is correct
6 Correct 154 ms 3308 KB Output is correct
7 Correct 113 ms 3436 KB Output is correct
8 Correct 112 ms 3436 KB Output is correct
9 Correct 106 ms 3436 KB Output is correct
10 Execution timed out 1078 ms 3436 KB Time limit exceeded
11 Halted 0 ms 0 KB -