Submission #90613

# Submission time Handle Problem Language Result Execution time Memory
90613 2018-12-22T22:45:01 Z Harvey_Rollens Divide and conquer (IZhO14_divide) C++17
0 / 100
1000 ms 12828 KB
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define st string
#define fr first
#define se second

const ll mod=1e9+7;

using namespace std;

ll p[100100], s[100100], n, a[100100];

int main()
{
    //freopen("1.txt", "r", stdin);
    //freopen("1.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    ll ans=0;
    cin>>n;

    for(ll i=1; i<=n; i++)
    {
        ll g, e;
        cin>>a[i]>>g>>e;

        p[i]=e+p[i-1];
        s[i]=g+s[i-1];
        ans=max(ans, g);
    }

    for(ll i=1; i<=n; i++)
    {
        for(ll j=i+1; j<=n; j++)
        {
            ll energy=p[j]-p[i-1];

            if(energy>=a[j]-a[i])
            {
                cout<<i<<" "<<j<<" "<<s[i]<<" "<<s[j]<<endl;

                ans=max(ans, s[j]-s[i-1]);
            }
        }
    }

    cout<<ans;
    return 0;
}
/*
4 6 3
1 2 1
2 4 1
2 3 2
3 1 4
1 4 3
3 4 10
*/
# 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 Incorrect 31 ms 768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 12828 KB Time limit exceeded
2 Halted 0 ms 0 KB -