Submission #90528

#TimeUsernameProblemLanguageResultExecution timeMemory
90528RAkhshonDivide and conquer (IZhO14_divide)C++14
48 / 100
1080 ms2556 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...