답안 #918010

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918010 2024-01-29T11:29:01 Z borisAngelov 금 캐기 (IZhO14_divide) C++17
48 / 100
1000 ms 2132 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 100005;

int n;

struct Element
{
    int pos;
    int gold;
    int energy;
};

Element a[maxn];

void fastIO()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main()
{
    fastIO();

    cin >> n;

    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i].pos >> a[i].gold >> a[i].energy;
    }

    long long ans = 0;

    for (int i = 1; i <= n; ++i)
    {
        long long sumEnergy = 0;
        long long sumGold = 0;

        for (int j = i; j <= n; ++j)
        {
            sumEnergy += a[j].energy;
            sumGold += a[j].gold;

            if (sumEnergy >= a[j].pos - a[i].pos)
            {
                ans = max(ans, sumGold);
            }
        }
    }

    cout << ans << endl;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 432 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 432 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 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 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 3 ms 348 KB Output is correct
23 Correct 13 ms 632 KB Output is correct
24 Correct 13 ms 636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 432 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 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 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 3 ms 348 KB Output is correct
23 Correct 13 ms 632 KB Output is correct
24 Correct 13 ms 636 KB Output is correct
25 Correct 16 ms 348 KB Output is correct
26 Correct 65 ms 852 KB Output is correct
27 Correct 60 ms 744 KB Output is correct
28 Execution timed out 1016 ms 2132 KB Time limit exceeded
29 Halted 0 ms 0 KB -