제출 #337240

#제출 시각아이디문제언어결과실행 시간메모리
337240BY_KUTBILIM금 캐기 (IZhO14_divide)C++14
48 / 100
1093 ms3308 KiB
/** @BY_KUTBILIM **/ #include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define ll long long int main(){ ios_base::sync_with_stdio(false); cin.tie(); int n; cin >> n; ll x[n], g[n], d[n]; ll pg[n+1], pd[n+1]; pg[0] = pd[0] = 0; for(int i = 0; i < n; i++){ cin >> x[i] >> g[i] >> d[i]; pg[i+1] = pg[i] + g[i]; pd[i+1] = pd[i] + d[i]; } ll ans = 0; for(int i = 1; i <= n; i++){ for(int j = 1; j <= i; j++){ if(pd[i] - pd[j-1] >= (x[i-1] - x[j-1]))ans = max(ans, pg[i] - pg[j-1]); } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...