답안 #157253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
157253 2019-10-10T08:34:51 Z shuvi_dola 스트랩 (JOI14_straps) C++14
100 / 100
39 ms 31836 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,long long> 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<=n;j++){
			dp[i][j] = max(dp[i-1][j], dp[i-1][min(n, j + rope[i].fi - 1)] + rope[i].se);
		}
	}
	cout << max(dp[n][0], dp[n][1]);
}
# 결과 실행 시간 메모리 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 380 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 380 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 3 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 3 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 3 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 3 ms 892 KB Output is correct
3 Correct 2 ms 824 KB Output is correct
4 Correct 2 ms 764 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 3 ms 888 KB Output is correct
7 Correct 2 ms 888 KB Output is correct
8 Correct 12 ms 12152 KB Output is correct
9 Correct 12 ms 12152 KB Output is correct
10 Correct 13 ms 12152 KB Output is correct
11 Correct 13 ms 12152 KB Output is correct
12 Correct 33 ms 31736 KB Output is correct
13 Correct 36 ms 31736 KB Output is correct
14 Correct 36 ms 31736 KB Output is correct
15 Correct 33 ms 31704 KB Output is correct
16 Correct 32 ms 31736 KB Output is correct
17 Correct 36 ms 31740 KB Output is correct
18 Correct 38 ms 31736 KB Output is correct
19 Correct 35 ms 31752 KB Output is correct
20 Correct 35 ms 31736 KB Output is correct
21 Correct 31 ms 31736 KB Output is correct
22 Correct 35 ms 31736 KB Output is correct
23 Correct 31 ms 31736 KB Output is correct
24 Correct 36 ms 31736 KB Output is correct
25 Correct 36 ms 31736 KB Output is correct
26 Correct 35 ms 31736 KB Output is correct
27 Correct 35 ms 31736 KB Output is correct
28 Correct 35 ms 31768 KB Output is correct
29 Correct 35 ms 31736 KB Output is correct
30 Correct 33 ms 31736 KB Output is correct
31 Correct 31 ms 31736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 888 KB Output is correct
2 Correct 3 ms 760 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 888 KB Output is correct
5 Correct 3 ms 760 KB Output is correct
6 Correct 3 ms 760 KB Output is correct
7 Correct 3 ms 760 KB Output is correct
8 Correct 3 ms 888 KB Output is correct
9 Correct 13 ms 12152 KB Output is correct
10 Correct 13 ms 12196 KB Output is correct
11 Correct 12 ms 12124 KB Output is correct
12 Correct 12 ms 12152 KB Output is correct
13 Correct 12 ms 12156 KB Output is correct
14 Correct 13 ms 12152 KB Output is correct
15 Correct 12 ms 12152 KB Output is correct
16 Correct 12 ms 12152 KB Output is correct
17 Correct 31 ms 31736 KB Output is correct
18 Correct 31 ms 31736 KB Output is correct
19 Correct 31 ms 31736 KB Output is correct
20 Correct 36 ms 31736 KB Output is correct
21 Correct 37 ms 31720 KB Output is correct
22 Correct 36 ms 31736 KB Output is correct
23 Correct 36 ms 31736 KB Output is correct
24 Correct 36 ms 31744 KB Output is correct
25 Correct 36 ms 31736 KB Output is correct
26 Correct 39 ms 31736 KB Output is correct
27 Correct 35 ms 31736 KB Output is correct
28 Correct 36 ms 31736 KB Output is correct
29 Correct 37 ms 31736 KB Output is correct
30 Correct 31 ms 31736 KB Output is correct
31 Correct 35 ms 31744 KB Output is correct
32 Correct 36 ms 31736 KB Output is correct
33 Correct 37 ms 31836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 31736 KB Output is correct
2 Correct 36 ms 31736 KB Output is correct
3 Correct 36 ms 31736 KB Output is correct
4 Correct 36 ms 31736 KB Output is correct
5 Correct 37 ms 31736 KB Output is correct
6 Correct 38 ms 31736 KB Output is correct
7 Correct 36 ms 31736 KB Output is correct
8 Correct 36 ms 31736 KB Output is correct
9 Correct 37 ms 31736 KB Output is correct
10 Correct 36 ms 31708 KB Output is correct
11 Correct 35 ms 31764 KB Output is correct
12 Correct 32 ms 31736 KB Output is correct
13 Correct 36 ms 31736 KB Output is correct
14 Correct 35 ms 31736 KB Output is correct
15 Correct 31 ms 31736 KB Output is correct
16 Correct 31 ms 31736 KB Output is correct
17 Correct 31 ms 31736 KB Output is correct
18 Correct 31 ms 31736 KB Output is correct
19 Correct 32 ms 31736 KB Output is correct
20 Correct 31 ms 31708 KB Output is correct
21 Correct 32 ms 31740 KB Output is correct
22 Correct 32 ms 31740 KB Output is correct
23 Correct 34 ms 31736 KB Output is correct
24 Correct 31 ms 31708 KB Output is correct
25 Correct 31 ms 31736 KB Output is correct