답안 #833873

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
833873 2023-08-22T09:15:47 Z kkkkk 금 캐기 (IZhO14_divide) C++14
17 / 100
1 ms 388 KB
#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 ;

}
/*
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 388 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 368 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 388 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 368 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 388 KB Output is correct
15 Incorrect 1 ms 340 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 388 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 368 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 388 KB Output is correct
15 Incorrect 1 ms 340 KB Output isn't correct
16 Halted 0 ms 0 KB -