답안 #1091063

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1091063 2024-09-19T16:31:43 Z pokmui9909 스트랩 (JOI14_straps) C++17
45 / 100
25 ms 32088 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define x first
#define y second

ll N; 
pair<ll, ll> A[2005];
ll D[2005][2005];

void chmax(ll &k, ll v){
    k = max(k, v);
}

int main(){
    cin.tie(0) -> sync_with_stdio(0);

    cin >> N;
    for(ll i = 1; i <= N; i++){
        cin >> A[i].x >> A[i].y;
    }
    sort(A + 1, A + N + 1, greater<pair<ll, ll>>());
    fill(D[0], D[2004] + 2005, -1e18);
    D[0][1] = 0;
    for(ll i = 0; i < N; i++){
        for(ll j = 0; j <= N; j++){
            chmax(D[i + 1][j], D[i][j]);
            if(j - 1 + A[i].x >= 0) chmax(D[i + 1][min(N, j - 1 + A[i].x)], D[i][j] + A[i].y);
        }
    }
    cout << *max_element(D[N], D[N] + N + 1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 31832 KB Output is correct
2 Correct 13 ms 31836 KB Output is correct
3 Correct 13 ms 31836 KB Output is correct
4 Correct 12 ms 31836 KB Output is correct
5 Correct 12 ms 31836 KB Output is correct
6 Correct 13 ms 31780 KB Output is correct
7 Correct 12 ms 31836 KB Output is correct
8 Correct 14 ms 31836 KB Output is correct
9 Correct 14 ms 31860 KB Output is correct
10 Correct 13 ms 31880 KB Output is correct
11 Correct 16 ms 31856 KB Output is correct
12 Correct 14 ms 31908 KB Output is correct
13 Correct 13 ms 31836 KB Output is correct
14 Correct 13 ms 31836 KB Output is correct
15 Correct 16 ms 31736 KB Output is correct
16 Correct 12 ms 31836 KB Output is correct
17 Correct 13 ms 31836 KB Output is correct
18 Correct 13 ms 31836 KB Output is correct
19 Correct 12 ms 31816 KB Output is correct
20 Correct 14 ms 31740 KB Output is correct
21 Correct 14 ms 31832 KB Output is correct
22 Correct 13 ms 31836 KB Output is correct
23 Correct 15 ms 32088 KB Output is correct
24 Incorrect 13 ms 31836 KB Output isn't correct
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 31832 KB Output is correct
2 Correct 12 ms 31832 KB Output is correct
3 Correct 13 ms 31884 KB Output is correct
4 Correct 16 ms 31812 KB Output is correct
5 Correct 14 ms 31780 KB Output is correct
6 Correct 12 ms 31832 KB Output is correct
7 Correct 12 ms 31840 KB Output is correct
8 Correct 16 ms 31832 KB Output is correct
9 Correct 16 ms 31808 KB Output is correct
10 Correct 15 ms 31836 KB Output is correct
11 Correct 17 ms 31848 KB Output is correct
12 Correct 20 ms 31872 KB Output is correct
13 Correct 21 ms 31836 KB Output is correct
14 Correct 21 ms 31884 KB Output is correct
15 Correct 20 ms 31836 KB Output is correct
16 Correct 19 ms 31836 KB Output is correct
17 Correct 21 ms 31836 KB Output is correct
18 Correct 20 ms 31836 KB Output is correct
19 Correct 19 ms 31836 KB Output is correct
20 Correct 20 ms 31836 KB Output is correct
21 Incorrect 20 ms 31836 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 31836 KB Output is correct
2 Correct 13 ms 31836 KB Output is correct
3 Correct 13 ms 31792 KB Output is correct
4 Correct 13 ms 31832 KB Output is correct
5 Correct 13 ms 31836 KB Output is correct
6 Correct 13 ms 31836 KB Output is correct
7 Correct 13 ms 31860 KB Output is correct
8 Correct 12 ms 31724 KB Output is correct
9 Correct 13 ms 31836 KB Output is correct
10 Correct 15 ms 31836 KB Output is correct
11 Correct 16 ms 31816 KB Output is correct
12 Correct 14 ms 31964 KB Output is correct
13 Correct 13 ms 31820 KB Output is correct
14 Correct 16 ms 31880 KB Output is correct
15 Correct 13 ms 31836 KB Output is correct
16 Correct 14 ms 31836 KB Output is correct
17 Correct 18 ms 31984 KB Output is correct
18 Correct 18 ms 31836 KB Output is correct
19 Correct 19 ms 31832 KB Output is correct
20 Correct 18 ms 31832 KB Output is correct
21 Correct 20 ms 31832 KB Output is correct
22 Correct 20 ms 31836 KB Output is correct
23 Correct 19 ms 31724 KB Output is correct
24 Correct 20 ms 31836 KB Output is correct
25 Correct 21 ms 31836 KB Output is correct
26 Correct 21 ms 31968 KB Output is correct
27 Correct 19 ms 31832 KB Output is correct
28 Correct 21 ms 31984 KB Output is correct
29 Correct 21 ms 31840 KB Output is correct
30 Correct 21 ms 31748 KB Output is correct
31 Correct 23 ms 31840 KB Output is correct
32 Correct 20 ms 31836 KB Output is correct
33 Correct 19 ms 31840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 31832 KB Output is correct
2 Correct 20 ms 31836 KB Output is correct
3 Correct 18 ms 31836 KB Output is correct
4 Correct 20 ms 31836 KB Output is correct
5 Correct 20 ms 31840 KB Output is correct
6 Correct 20 ms 31832 KB Output is correct
7 Correct 18 ms 31828 KB Output is correct
8 Correct 18 ms 31832 KB Output is correct
9 Correct 20 ms 31844 KB Output is correct
10 Correct 20 ms 31844 KB Output is correct
11 Correct 20 ms 31844 KB Output is correct
12 Correct 21 ms 31844 KB Output is correct
13 Correct 20 ms 31840 KB Output is correct
14 Correct 22 ms 31844 KB Output is correct
15 Correct 21 ms 31844 KB Output is correct
16 Correct 19 ms 31832 KB Output is correct
17 Correct 20 ms 31832 KB Output is correct
18 Correct 19 ms 31836 KB Output is correct
19 Incorrect 25 ms 31964 KB Output isn't correct
20 Halted 0 ms 0 KB -