# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1091064 |
2024-09-19T16:33:30 Z |
pokmui9909 |
스트랩 (JOI14_straps) |
C++17 |
|
26 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) 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);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
31836 KB |
Output is correct |
2 |
Correct |
14 ms |
31700 KB |
Output is correct |
3 |
Correct |
12 ms |
31836 KB |
Output is correct |
4 |
Correct |
13 ms |
31832 KB |
Output is correct |
5 |
Correct |
12 ms |
31836 KB |
Output is correct |
6 |
Correct |
13 ms |
31740 KB |
Output is correct |
7 |
Correct |
12 ms |
31836 KB |
Output is correct |
8 |
Correct |
16 ms |
31836 KB |
Output is correct |
9 |
Correct |
13 ms |
31836 KB |
Output is correct |
10 |
Correct |
13 ms |
31724 KB |
Output is correct |
11 |
Correct |
13 ms |
31744 KB |
Output is correct |
12 |
Correct |
13 ms |
31836 KB |
Output is correct |
13 |
Correct |
14 ms |
31764 KB |
Output is correct |
14 |
Correct |
14 ms |
31836 KB |
Output is correct |
15 |
Correct |
13 ms |
31836 KB |
Output is correct |
16 |
Correct |
13 ms |
31836 KB |
Output is correct |
17 |
Correct |
13 ms |
31832 KB |
Output is correct |
18 |
Correct |
13 ms |
31836 KB |
Output is correct |
19 |
Correct |
12 ms |
31840 KB |
Output is correct |
20 |
Correct |
13 ms |
31832 KB |
Output is correct |
21 |
Correct |
14 ms |
31836 KB |
Output is correct |
22 |
Correct |
12 ms |
31892 KB |
Output is correct |
23 |
Correct |
11 ms |
31836 KB |
Output is correct |
24 |
Incorrect |
13 ms |
31836 KB |
Output isn't correct |
25 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
31832 KB |
Output is correct |
2 |
Correct |
13 ms |
31712 KB |
Output is correct |
3 |
Correct |
13 ms |
31836 KB |
Output is correct |
4 |
Correct |
16 ms |
31836 KB |
Output is correct |
5 |
Correct |
13 ms |
31876 KB |
Output is correct |
6 |
Correct |
12 ms |
31836 KB |
Output is correct |
7 |
Correct |
12 ms |
31840 KB |
Output is correct |
8 |
Correct |
16 ms |
31836 KB |
Output is correct |
9 |
Correct |
15 ms |
31840 KB |
Output is correct |
10 |
Correct |
17 ms |
31956 KB |
Output is correct |
11 |
Correct |
15 ms |
31788 KB |
Output is correct |
12 |
Correct |
21 ms |
31924 KB |
Output is correct |
13 |
Correct |
21 ms |
31844 KB |
Output is correct |
14 |
Correct |
20 ms |
31780 KB |
Output is correct |
15 |
Correct |
23 ms |
31836 KB |
Output is correct |
16 |
Correct |
20 ms |
31832 KB |
Output is correct |
17 |
Correct |
21 ms |
31792 KB |
Output is correct |
18 |
Correct |
21 ms |
31832 KB |
Output is correct |
19 |
Correct |
23 ms |
31748 KB |
Output is correct |
20 |
Correct |
21 ms |
31832 KB |
Output is correct |
21 |
Incorrect |
19 ms |
31836 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
31836 KB |
Output is correct |
2 |
Correct |
13 ms |
31832 KB |
Output is correct |
3 |
Correct |
13 ms |
31836 KB |
Output is correct |
4 |
Correct |
13 ms |
31900 KB |
Output is correct |
5 |
Correct |
12 ms |
31744 KB |
Output is correct |
6 |
Correct |
12 ms |
31836 KB |
Output is correct |
7 |
Correct |
12 ms |
31712 KB |
Output is correct |
8 |
Correct |
13 ms |
31836 KB |
Output is correct |
9 |
Correct |
17 ms |
31836 KB |
Output is correct |
10 |
Correct |
15 ms |
31776 KB |
Output is correct |
11 |
Correct |
17 ms |
31840 KB |
Output is correct |
12 |
Correct |
15 ms |
31932 KB |
Output is correct |
13 |
Correct |
15 ms |
31836 KB |
Output is correct |
14 |
Correct |
15 ms |
31836 KB |
Output is correct |
15 |
Correct |
14 ms |
31784 KB |
Output is correct |
16 |
Correct |
14 ms |
31960 KB |
Output is correct |
17 |
Correct |
21 ms |
31980 KB |
Output is correct |
18 |
Correct |
22 ms |
31836 KB |
Output is correct |
19 |
Correct |
21 ms |
31964 KB |
Output is correct |
20 |
Correct |
21 ms |
31836 KB |
Output is correct |
21 |
Correct |
23 ms |
31984 KB |
Output is correct |
22 |
Correct |
26 ms |
31836 KB |
Output is correct |
23 |
Correct |
20 ms |
31836 KB |
Output is correct |
24 |
Correct |
22 ms |
31832 KB |
Output is correct |
25 |
Correct |
21 ms |
31912 KB |
Output is correct |
26 |
Correct |
22 ms |
31984 KB |
Output is correct |
27 |
Correct |
20 ms |
31832 KB |
Output is correct |
28 |
Correct |
22 ms |
31952 KB |
Output is correct |
29 |
Correct |
21 ms |
31836 KB |
Output is correct |
30 |
Correct |
21 ms |
31836 KB |
Output is correct |
31 |
Correct |
21 ms |
31840 KB |
Output is correct |
32 |
Correct |
22 ms |
32088 KB |
Output is correct |
33 |
Correct |
20 ms |
31840 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
31836 KB |
Output is correct |
2 |
Correct |
22 ms |
31956 KB |
Output is correct |
3 |
Correct |
20 ms |
31836 KB |
Output is correct |
4 |
Correct |
21 ms |
31896 KB |
Output is correct |
5 |
Correct |
19 ms |
31836 KB |
Output is correct |
6 |
Correct |
20 ms |
32056 KB |
Output is correct |
7 |
Correct |
20 ms |
31840 KB |
Output is correct |
8 |
Correct |
21 ms |
31836 KB |
Output is correct |
9 |
Correct |
21 ms |
31836 KB |
Output is correct |
10 |
Correct |
21 ms |
31836 KB |
Output is correct |
11 |
Correct |
22 ms |
31844 KB |
Output is correct |
12 |
Correct |
21 ms |
31844 KB |
Output is correct |
13 |
Correct |
20 ms |
31844 KB |
Output is correct |
14 |
Correct |
22 ms |
31788 KB |
Output is correct |
15 |
Correct |
20 ms |
31832 KB |
Output is correct |
16 |
Correct |
19 ms |
31872 KB |
Output is correct |
17 |
Correct |
21 ms |
31832 KB |
Output is correct |
18 |
Correct |
19 ms |
31832 KB |
Output is correct |
19 |
Incorrect |
22 ms |
31968 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |