답안 #167200

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167200 2019-12-06T13:51:42 Z muhammad_hokimiyon 금 캐기 (IZhO14_divide) C++14
48 / 100
1000 ms 2296 KB
#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

#define fi first
#define se second
#define LL long long

using namespace std;

const int N = 2e5 + 7;
const int mod = 1e9 + 7;

int n;
int x[N];
LL g[N];
LL d[N];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    cin >> n;
    LL ans = 0;
    for( int i = 1; i <= n; i++ ){
        cin >> x[i] >> g[i] >> d[i];
        ans = max( ans , g[i] );
    }
    for( int i = 1; i <= n; i++ ){
        LL sum = g[i];
        LL cnt = d[i];
        for( int j = i + 1; j <= n; j++ ){
            cnt += d[j];
            sum += g[j];
            if( x[j] - x[i] <= cnt ){
                ans = max( ans , sum );
            }
        }
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 508 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 4 ms 380 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 18 ms 504 KB Output is correct
12 Correct 18 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 504 KB Output is correct
2 Correct 74 ms 632 KB Output is correct
3 Correct 74 ms 784 KB Output is correct
4 Execution timed out 1073 ms 2296 KB Time limit exceeded
5 Halted 0 ms 0 KB -