Submission #1091816

# Submission time Handle Problem Language Result Execution time Memory
1091816 2024-09-22T09:30:36 Z alex2407 Divide and conquer (IZhO14_divide) C++17
48 / 100
1000 ms 3416 KB
#include <iostream>

using namespace std;

long long a[3][110000], g[110000], en[110000];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n, ans = 0;
    cin >> n;
    g[0] = 0;
    en[0] = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[0][i] >> a[1][i] >> a[2][i];
        g[i + 1] = g[i] + a[1][i];
        en[i + 1] = en[i] + a[2][i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            if (a[0][j] - a[0][i] <= en[j + 1] - en[i + 1] + a[2][i]) {
                ans = max(ans, g[j + 1] - g[i + 1] + a[1][i]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 464 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 464 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 476 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 2 ms 472 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 472 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 2 ms 476 KB Output is correct
23 Correct 10 ms 788 KB Output is correct
24 Correct 11 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 464 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 476 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 2 ms 472 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 472 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 2 ms 476 KB Output is correct
23 Correct 10 ms 788 KB Output is correct
24 Correct 11 ms 604 KB Output is correct
25 Correct 15 ms 600 KB Output is correct
26 Correct 57 ms 860 KB Output is correct
27 Correct 62 ms 860 KB Output is correct
28 Execution timed out 1060 ms 3416 KB Time limit exceeded
29 Halted 0 ms 0 KB -