Submission #1040378

#TimeUsernameProblemLanguageResultExecution timeMemory
1040378vjudge1Divide and conquer (IZhO14_divide)C++17
48 / 100
1037 ms5712 KiB
#include <bits/stdc++.h> using namespace std; main() { long long n; cin >> n; long long x[n+1],g[n+1],d[n+1]; for (long long i=1; i<=n; i++) cin >> x[i] >> g[i] >> d[i]; long long res=0; for (long long i=1; i<=n; i++) { long long temp=0,temp2=0; for (long long j=i; j<=n; j++) { temp+=g[j]; temp2+=d[j]; if (x[j]-x[i]<=temp2) res=max(res,temp); } } cout << res; return 0; }

Compilation message (stderr)

divide.cpp:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...