Submission #91083

#TimeUsernameProblemLanguageResultExecution timeMemory
91083HideoDivide and conquer (IZhO14_divide)C++14
17 / 100
62 ms1312 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; const int INF = 1e9 + 7; int x[N], g[N], d[N]; int pre[N], prg[N]; int n, mx; main(){ cin >> n; for (int i = 1; i <= n; i++){ scanf("%d%d%d", &x[i], &g[i], &d[i]); mx = max(g[i], mx); prg[i] = prg[i - 1] + g[i]; pre[i] = pre[i - 1] + d[i]; } for (int i = 1; i <= n; i++){ for (int j = i + 1; j <= n; j++){ if (pre[j] - pre[i - 1] >= x[j] - x[i]){ mx = max (prg[j] - prg[i - 1], mx); } } } cout << mx; }

Compilation message (stderr)

divide.cpp:11:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
divide.cpp: In function 'int main()':
divide.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d", &x[i], &g[i], &d[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...