답안 #342917

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
342917 2021-01-03T08:21:08 Z Habib_Assoev 금 캐기 (IZhO14_divide) C++14
0 / 100
0 ms 364 KB
# include<bits/stdc++.h>
#define in freopen ("measurement.in", "r", stdin);
#define out freopen("measurement.out", "w", stdout);
#define ll long long
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std ;
long long const N = 1e6 + 7;
long long N1 = 1e9 + 7;
int main( ){
    //in out
    speed ;
    ll TJK = 1 ;
    // cin >> TJK ;
    while( TJK -- ){
        ll n;
        cin >> n;
        ll a[n] , g[n] , d[n];
        for( int i = 0 ; i < n ; i ++ ){
            cin >> a[i] >> g[i] >> d[i];
        }
        ll l = 0 , r = 0 , go = 0 , di = 0 , en = 0 , mx = 0;
        for( int i = 0 ; i < n ; i ++ ){
            go += g[i];
            di = a[r] - a[l];
            en += d[i];
            if( di <= en ){
                r ++;
                mx = max( mx , go );
            }else{
                while( di > en ){
                    go -= g[l];
                    en -= d[l];
                    l ++;
                    di = a[r] - a[l];
                }
                mx = max( mx , go );
            }
        }
        cout << mx << endl;
    }
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Incorrect 0 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Incorrect 0 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Incorrect 0 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -