답안 #101033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101033 2019-03-16T05:23:31 Z a1_N 금 캐기 (IZhO14_divide) C++14
48 / 100
1000 ms 1984 KB
#include <bits/stdc++.h>

#define int long long

using namespace std;
 
const int N = (int)1e5 + 55;
 
int n,a[N],g[N],e[N],ans;
 
main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i] >> g[i] >> e[i];
    }
 
    for(int i = 1; i <= n; i++){
        int gold = 0,energy = 0;
        for(int j = i; j <= n; j++){
            gold += g[j];
            energy += e[j];
            if(a[j] - a[i] <= energy){
                ans = max(ans, gold);
            }
        }
    }
 
    cout << ans;
    return 0;
}

Compilation message

divide.cpp:11:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 284 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 4 ms 428 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 356 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 8 ms 384 KB Output is correct
11 Correct 21 ms 580 KB Output is correct
12 Correct 28 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 512 KB Output is correct
2 Correct 78 ms 640 KB Output is correct
3 Correct 89 ms 776 KB Output is correct
4 Execution timed out 1054 ms 1984 KB Time limit exceeded
5 Halted 0 ms 0 KB -