답안 #561502

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
561502 2022-05-13T02:03:44 Z gg123_pe 금 캐기 (IZhO14_divide) C++14
48 / 100
1000 ms 3252 KB
#include <bits/stdc++.h>
using namespace std; 

typedef long long ll; 
#define f(i,a,b) for(int i = a; i < b; i++)
const int N = 1e5 + 5; 

int n; 
ll a[N], g[N], e[N], sg[N], se[N], ans; 

int main(){
    cin >> n;

    f(i,1,n+1) {
        cin >> a[i] >> g[i] >> e[i]; 
        sg[i] = sg[i-1] + g[i]; 
        se[i] = se[i-1] + e[i]; 
    }

    f(i,1,n+1){
        f(j,i,n+1){
            if(se[j]-se[i-1] >= a[j]-a[i]){
                ans = max(ans, sg[j]-sg[i-1]);
            }
        }
    }
    cout << ans << "\n"; 
    return 0; 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 356 KB Output is correct
16 Correct 1 ms 320 KB Output is correct
17 Correct 2 ms 316 KB Output is correct
18 Correct 3 ms 320 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 3 ms 340 KB Output is correct
21 Correct 3 ms 340 KB Output is correct
22 Correct 5 ms 340 KB Output is correct
23 Correct 18 ms 596 KB Output is correct
24 Correct 19 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 356 KB Output is correct
16 Correct 1 ms 320 KB Output is correct
17 Correct 2 ms 316 KB Output is correct
18 Correct 3 ms 320 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 3 ms 340 KB Output is correct
21 Correct 3 ms 340 KB Output is correct
22 Correct 5 ms 340 KB Output is correct
23 Correct 18 ms 596 KB Output is correct
24 Correct 19 ms 572 KB Output is correct
25 Correct 19 ms 580 KB Output is correct
26 Correct 73 ms 816 KB Output is correct
27 Correct 70 ms 792 KB Output is correct
28 Execution timed out 1090 ms 3252 KB Time limit exceeded
29 Halted 0 ms 0 KB -