제출 #170222

#제출 시각아이디문제언어결과실행 시간메모리
170222beso123금 캐기 (IZhO14_divide)C++14
17 / 100
223 ms5624 KiB
#include <bits/stdc++.h> #define int long long #define pii pair<int, pair<int,int> > #define x first #define y second.first #define z second.second using namespace std; int n; pii a[100005]; main(){ cin>>n; for(int k=1;k<=n;k++){ int a1,b,c; cin>>a1>>b>>c; a[k]={a1,{b,c}}; } int l=1; int pos=a[1].x,val=0; int ans=a[1].y,sc=a[1].z; int pas=ans; for(int r=1;r<=n;r++){ if(r!=1){ ans+=a[r].y; sc+=a[r].z; val=a[r].x-pos; } while(l<=r && sc<val){ ans-=a[l].y; sc-=a[l].z; pos=a[l+1].x; val=max((int)0,a[r].x-pos); l++; } pas=max(pas,ans); } cout<<pas; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

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