제출 #833873

#제출 시각아이디문제언어결과실행 시간메모리
833873kkkkk금 캐기 (IZhO14_divide)C++14
17 / 100
1 ms388 KiB
#include<bits/stdc++.h> #define ll long long #define pb push_back #define srt(x) sort( x.begin() , x.end() ) #define F first #define S second #define int ll using namespace std; const int N = 1e5 + 7 , MOD = 32768 , INF = 9e18 ; int n , t , k , ans , sum , cnt , mx = -INF ; int c[N] ; int g[N] ; int e[N] ; signed main() { //freopen( ".in" , "r" , stdin ) ; //freopen( ".out" , "w" , stdout ) ; ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n ; for ( int i = 0 ; i < n ; i++ ) { cin >> c[i] >> g[i] >> e[i] ; } int l = 0 ; for ( int r = 0 ; r < n ; r++ ) { sum += g[r] ; cnt += e[r] ; while ( c[r] - c[l] > cnt && l < r ) { sum -= g[l] ; cnt -= e[l] ; l++ ; } mx = max( sum , mx ) ; } cout << mx ; } /* */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...