답안 #37758

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
37758 2017-12-28T04:31:46 Z Talant 금 캐기 (IZhO14_divide) C++14
48 / 100
1000 ms 4748 KB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair

using namespace std;

typedef long long ll;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 7;

int n;
int x[N],g[N],d[N];
ll p[N],res[N],mx;

int main () {
        cin >> n;

        for (int i = 1; i <= n; i ++) {
                cin >> x[i] >> g[i] >> d[i];
                p[i] = p[i - 1] + d[i];
                res[i] = res[i - 1] + g[i];
        }
        for (int i = 1; i <= n; i ++) {
                for (int j = i; j <= n; j ++) {
                        ll o = p[j] - p[i - 1];
                        ll len = (x[j] - x[i]);
                        ll ans = (res[j] - res[i - 1]);
                        if (o >= len)
                                mx = max(mx,ans);
                }
        }
        cout << mx << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4748 KB Output is correct
2 Correct 0 ms 4748 KB Output is correct
3 Correct 0 ms 4748 KB Output is correct
4 Correct 0 ms 4748 KB Output is correct
5 Correct 0 ms 4748 KB Output is correct
6 Correct 0 ms 4748 KB Output is correct
7 Correct 0 ms 4748 KB Output is correct
8 Correct 0 ms 4748 KB Output is correct
9 Correct 0 ms 4748 KB Output is correct
10 Correct 0 ms 4748 KB Output is correct
11 Correct 0 ms 4748 KB Output is correct
12 Correct 0 ms 4748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4748 KB Output is correct
2 Correct 0 ms 4748 KB Output is correct
3 Correct 0 ms 4748 KB Output is correct
4 Correct 0 ms 4748 KB Output is correct
5 Correct 0 ms 4748 KB Output is correct
6 Correct 3 ms 4748 KB Output is correct
7 Correct 0 ms 4748 KB Output is correct
8 Correct 0 ms 4748 KB Output is correct
9 Correct 0 ms 4748 KB Output is correct
10 Correct 3 ms 4748 KB Output is correct
11 Correct 33 ms 4748 KB Output is correct
12 Correct 23 ms 4748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 4748 KB Output is correct
2 Correct 113 ms 4748 KB Output is correct
3 Correct 113 ms 4748 KB Output is correct
4 Execution timed out 1000 ms 4748 KB Execution timed out
5 Halted 0 ms 0 KB -