# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
157233 |
2019-10-10T08:07:12 Z |
manh9203 |
스트랩 (JOI14_straps) |
C++17 |
|
27 ms |
23160 KB |
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int N = 2e3 + 5;
long long n,dp[N][N];
pair<long long,int> rope[N];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for(int i=1;i<=n;i++) cin >> rope[i].fi >> rope[i].se;
sort(rope+1, rope+1+n);
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
dp[i][j] = max(dp[i-1][j], dp[i-1][min(n, j + rope[i].fi - 1)] + rope[i].se);
}
}
cout << dp[n][1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
25 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
760 KB |
Output is correct |
3 |
Correct |
3 ms |
760 KB |
Output is correct |
4 |
Correct |
3 ms |
732 KB |
Output is correct |
5 |
Correct |
3 ms |
760 KB |
Output is correct |
6 |
Correct |
2 ms |
760 KB |
Output is correct |
7 |
Correct |
3 ms |
764 KB |
Output is correct |
8 |
Correct |
9 ms |
8312 KB |
Output is correct |
9 |
Correct |
11 ms |
8272 KB |
Output is correct |
10 |
Correct |
11 ms |
8312 KB |
Output is correct |
11 |
Correct |
9 ms |
8312 KB |
Output is correct |
12 |
Correct |
23 ms |
23032 KB |
Output is correct |
13 |
Correct |
26 ms |
23032 KB |
Output is correct |
14 |
Correct |
26 ms |
23160 KB |
Output is correct |
15 |
Correct |
23 ms |
23032 KB |
Output is correct |
16 |
Correct |
23 ms |
23004 KB |
Output is correct |
17 |
Correct |
26 ms |
23032 KB |
Output is correct |
18 |
Correct |
23 ms |
23032 KB |
Output is correct |
19 |
Correct |
26 ms |
23032 KB |
Output is correct |
20 |
Correct |
23 ms |
23032 KB |
Output is correct |
21 |
Incorrect |
23 ms |
23160 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
760 KB |
Output is correct |
2 |
Correct |
2 ms |
760 KB |
Output is correct |
3 |
Correct |
2 ms |
760 KB |
Output is correct |
4 |
Correct |
3 ms |
760 KB |
Output is correct |
5 |
Correct |
3 ms |
760 KB |
Output is correct |
6 |
Correct |
2 ms |
760 KB |
Output is correct |
7 |
Correct |
3 ms |
760 KB |
Output is correct |
8 |
Correct |
3 ms |
760 KB |
Output is correct |
9 |
Correct |
9 ms |
8312 KB |
Output is correct |
10 |
Correct |
11 ms |
8236 KB |
Output is correct |
11 |
Correct |
10 ms |
8312 KB |
Output is correct |
12 |
Correct |
11 ms |
8284 KB |
Output is correct |
13 |
Correct |
10 ms |
8312 KB |
Output is correct |
14 |
Correct |
11 ms |
8312 KB |
Output is correct |
15 |
Correct |
10 ms |
8312 KB |
Output is correct |
16 |
Correct |
15 ms |
8312 KB |
Output is correct |
17 |
Correct |
27 ms |
23032 KB |
Output is correct |
18 |
Correct |
23 ms |
23032 KB |
Output is correct |
19 |
Correct |
26 ms |
23032 KB |
Output is correct |
20 |
Correct |
22 ms |
23032 KB |
Output is correct |
21 |
Correct |
27 ms |
23032 KB |
Output is correct |
22 |
Correct |
27 ms |
23084 KB |
Output is correct |
23 |
Correct |
23 ms |
23032 KB |
Output is correct |
24 |
Correct |
27 ms |
23160 KB |
Output is correct |
25 |
Correct |
23 ms |
23032 KB |
Output is correct |
26 |
Correct |
23 ms |
23076 KB |
Output is correct |
27 |
Correct |
23 ms |
23032 KB |
Output is correct |
28 |
Correct |
23 ms |
23032 KB |
Output is correct |
29 |
Correct |
23 ms |
23032 KB |
Output is correct |
30 |
Correct |
23 ms |
23032 KB |
Output is correct |
31 |
Correct |
23 ms |
23032 KB |
Output is correct |
32 |
Correct |
23 ms |
23032 KB |
Output is correct |
33 |
Correct |
23 ms |
23032 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
23160 KB |
Output is correct |
2 |
Correct |
22 ms |
23032 KB |
Output is correct |
3 |
Correct |
22 ms |
23032 KB |
Output is correct |
4 |
Correct |
23 ms |
23032 KB |
Output is correct |
5 |
Correct |
23 ms |
23032 KB |
Output is correct |
6 |
Correct |
23 ms |
23032 KB |
Output is correct |
7 |
Correct |
23 ms |
23032 KB |
Output is correct |
8 |
Correct |
23 ms |
23032 KB |
Output is correct |
9 |
Incorrect |
23 ms |
23032 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |