답안 #37392

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

using namespace std;

typedef long long ll;

const int N = 1e5 + 5;

int n, x[N], g[N], e[N];

ll de[N], dg[N], ans;

int main() {
//    freopen("divide.in", "r", stdin);
//    freopen("divide.out", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> x[i] >> g[i] >> e[i];
        dg[i] += dg[i - 1] + g[i];
        de[i] += de[i - 1] + e[i];
    }
    for (int l = 1; l <= n; ++l) {
        for (int r = l; r <= n; ++r) {
            int len = x[r] - x[l];
//            cout << l << " " << r << " " << dg[r] - dg[l - 1] << "\n";
            if (len <= de[r] - de[l - 1] && dg[r] - dg[l - 1] > ans) {
                ans = dg[r] - dg[l - 1];
            }
        }
    }
    cout << ans;
}
# 결과 실행 시간 메모리 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 3 ms 4748 KB Output is correct
9 Correct 3 ms 4748 KB Output is correct
10 Correct 3 ms 4748 KB Output is correct
11 Correct 19 ms 4748 KB Output is correct
12 Correct 19 ms 4748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 4748 KB Output is correct
2 Correct 89 ms 4748 KB Output is correct
3 Correct 83 ms 4748 KB Output is correct
4 Execution timed out 1000 ms 4748 KB Execution timed out
5 Halted 0 ms 0 KB -