답안 #91083

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
91083 2018-12-26T07:36:20 Z Hideo 금 캐기 (IZhO14_divide) C++14
17 / 100
62 ms 1312 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 1e6 + 7;
const int INF = 1e9 + 7;

int x[N], g[N], d[N];
int pre[N], prg[N];
int n, mx;

main(){
	cin >> n;
	for (int i = 1; i <= n; i++){
        scanf("%d%d%d", &x[i], &g[i], &d[i]);
        mx = max(g[i], mx);
        prg[i] = prg[i - 1] + g[i];
        pre[i] = pre[i - 1] + d[i];
	}
	for (int i = 1; i <= n; i++){
        for (int j = i + 1; j <= n; j++){
            if (pre[j] - pre[i - 1] >= x[j] - x[i]){
                mx = max (prg[j] - prg[i - 1], mx);
            }
        }
	}
	cout << mx;
}

Compilation message

divide.cpp:11:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
divide.cpp: In function 'int main()':
divide.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d", &x[i], &g[i], &d[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Incorrect 2 ms 604 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 756 KB Output is correct
2 Correct 62 ms 1028 KB Output is correct
3 Incorrect 54 ms 1312 KB Output isn't correct
4 Halted 0 ms 0 KB -