Submission #90528

# Submission time Handle Problem Language Result Execution time Memory
90528 2018-12-22T08:32:18 Z RAkhshon Divide and conquer (IZhO14_divide) C++14
48 / 100
1000 ms 2556 KB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll x[101101], g[101010], d[101101], s[101010], a[101101];
int main(){
    ll n;
    scanf("%lld", &n);
    for(ll i = 1; i <= n; i++){
        scanf("%lld %lld %lld", &x[i], &g[i], &d[i]);
        s[i]=s[i-1]+g[i];
        a[i]=a[i-1]+d[i];
    }
    ll ans = 0;
    for(ll i = 1; i <= n; i ++){
        for(ll j = i; j <= n; j ++){
            ll l = i, r = j;
            if(x[r]-x[l] <= a[r]-a[l-1]) ans=max(ans,s[r] - s[l-1]);
        }
    }
    printf("%lld", ans);
    return 0;
}

Compilation message

divide.cpp: In function 'int main()':
divide.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &n);
     ~~~~~^~~~~~~~~~~~
divide.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld %lld", &x[i], &g[i], &d[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 572 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 732 KB Output is correct
12 Correct 2 ms 732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 732 KB Output is correct
2 Correct 2 ms 732 KB Output is correct
3 Correct 2 ms 732 KB Output is correct
4 Correct 2 ms 732 KB Output is correct
5 Correct 2 ms 732 KB Output is correct
6 Correct 3 ms 732 KB Output is correct
7 Correct 3 ms 732 KB Output is correct
8 Correct 3 ms 732 KB Output is correct
9 Correct 3 ms 760 KB Output is correct
10 Correct 4 ms 760 KB Output is correct
11 Correct 14 ms 764 KB Output is correct
12 Correct 13 ms 804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 804 KB Output is correct
2 Correct 69 ms 1036 KB Output is correct
3 Correct 60 ms 1036 KB Output is correct
4 Execution timed out 1080 ms 2556 KB Time limit exceeded
5 Halted 0 ms 0 KB -