Submission #1186750

#TimeUsernameProblemLanguageResultExecution timeMemory
1186750ziyad_alharbi금 캐기 (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]; vector<array<int,4>>st; for(int x=0;x<n;x++)cin>>a[x][0]>>a[x][1]>>a[x][2]; int ans=0; for(int x=n-1;x>=0;x--) { array<int,3>b=a[x]; int r=b[0]; while(st.size()) { array<int,4>c=st.back(); if(c[1]-b[0]<=b[2]+c[3]) { r=c[1]; b[2]+=c[3]; b[1]+=c[2]; st.pop_back(); } else break; } ans=max(b[1],ans); st.push_back({b[0],r,b[1],b[2]}); } 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...