답안 #638948

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
638948 2022-09-08T04:04:51 Z bonk 금 캐기 (IZhO14_divide) C++14
48 / 100
1000 ms 2516 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n; cin >> n;
    vector<tuple<ll, ll, ll>>v(n);

    for(int i = 0; i < n; i++){
        ll x, g, d; cin >> x >> g >> d;
        v[i] = {x, g, d};
    }

    ll ans = 0;
    for(int i = 0; i < n; i++){
        auto [x1, g1, d1] = v[i];
        ans = max(ans, g1);
        ll tmp = g1;
        ll energy = d1;
        for(int j = i + 1; j < n; j++){
            auto [x2, g2, d2] = v[j];
            ll dis = x2 - x1;
            energy += d2;
            tmp += g2;

            if(energy >= dis) ans = max(ans, tmp);
        }
    }

    cout << ans << '\n';

    return 0;
}

Compilation message

divide.cpp: In function 'int main()':
divide.cpp:18:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   18 |         auto [x1, g1, d1] = v[i];
      |              ^
divide.cpp:23:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   23 |             auto [x2, g2, d2] = v[j];
      |                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 320 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 320 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 4 ms 340 KB Output is correct
23 Correct 14 ms 540 KB Output is correct
24 Correct 15 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 320 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 4 ms 340 KB Output is correct
23 Correct 14 ms 540 KB Output is correct
24 Correct 15 ms 460 KB Output is correct
25 Correct 18 ms 504 KB Output is correct
26 Correct 53 ms 596 KB Output is correct
27 Correct 53 ms 724 KB Output is correct
28 Execution timed out 1071 ms 2516 KB Time limit exceeded
29 Halted 0 ms 0 KB -