Submission #1187189

#TimeUsernameProblemLanguageResultExecution timeMemory
1187189ziyad_alharbiDivide and conquer (IZhO14_divide)C++20
17 / 100
0 ms328 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define cc main cc() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin>>n; array<int,3>a[n]; for(int x=0;x<n;x++)cin>>a[x][0]>>a[x][1]>>a[x][2]; int l=a[0][0],i=0,r=a[0][0],sg=0,st=0,ans=0; for(int x=0;x<n;x++) { sg+=a[x][1]; st+=a[x][2]; r=a[x][0]; while(r-l>st) { sg-=a[i][1]; st-=a[i][2]; i++; l=a[i][0]; } ans=max(ans,sg); } cout<<ans<<'\n'; }

Compilation message (stderr)

divide.cpp:4:12: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | #define cc main
      |            ^~~~
divide.cpp:5:1: note: in expansion of macro 'cc'
    5 | cc()
      | ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...