답안 #638810

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
638810 2022-09-07T14:30:47 Z penguin133 Let's Win the Election (JOI22_ho_t3) C++14
56 / 100
2500 ms 414468 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int, int>
#define pii pair<int, pair<int, int> > 
#define fi first
#define se second
int n,k;
pair<long double, long double> A[300005];
bool cmp(pair<long double, long double> a, pair<long double, long double> b){
	if(a.se == -1)return 0;
	if(b.se == -1)return 1;
	return a.se < b.se;
}
long double dp[505][505][105];
void solve(){
	cin >> n >> k;
	int cnt = 0;
	for(int i=1;i<=n;i++)cin >> A[i].fi >> A[i].se, cnt += (A[i].se != -1);
	sort(A+1, A+n+1, cmp);
	long double ans = 1e18;
	for(int y=0;y<cnt;y++){
		for(int i=1;i<=k;i++){
			for(int j=0;j<=n;j++){
				dp[0][i][j] = 1e18;
				if(j)dp[0][0][j] = 1e18;
			}
		}
		dp[0][0][0] = 0.0;
		for(int i=1;i<=n;i++){
			for(int j=0;j<=k;j++){
				for(int x=0;x<=y;x++){
					dp[i][j][x] = dp[i-1][j][x];
					if(j && x && A[i].se > 0)dp[i][j][x] = min(dp[i][j][x], dp[i-1][j-1][x-1] + A[i].se/x);
					if(j)dp[i][j][x] = min(dp[i][j][x], dp[i-1][j-1][x] + A[i].fi/(y+1));
				}
			}
		}
		ans = min(ans, dp[n][k][y]);
	}
	
	
	
	cout << fixed << setprecision(12) << ans;
}
 
main(){
	ios::sync_with_stdio(0);cin.tie(0);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
}

Compilation message

Main.cpp:47:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   47 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 456 KB Output is correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 2 ms 724 KB Output is correct
18 Correct 2 ms 724 KB Output is correct
19 Correct 1 ms 852 KB Output is correct
20 Correct 1 ms 852 KB Output is correct
21 Correct 1 ms 852 KB Output is correct
22 Correct 2 ms 836 KB Output is correct
23 Correct 1 ms 852 KB Output is correct
24 Correct 1 ms 852 KB Output is correct
25 Correct 2 ms 1112 KB Output is correct
26 Correct 2 ms 1108 KB Output is correct
27 Correct 2 ms 852 KB Output is correct
28 Correct 2 ms 852 KB Output is correct
29 Correct 2 ms 852 KB Output is correct
30 Correct 3 ms 852 KB Output is correct
31 Correct 2 ms 852 KB Output is correct
32 Correct 2 ms 852 KB Output is correct
33 Correct 2 ms 852 KB Output is correct
34 Correct 2 ms 852 KB Output is correct
35 Correct 2 ms 852 KB Output is correct
36 Correct 2 ms 856 KB Output is correct
37 Correct 2 ms 864 KB Output is correct
38 Correct 2 ms 860 KB Output is correct
39 Correct 2 ms 852 KB Output is correct
40 Correct 2 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 456 KB Output is correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 2 ms 724 KB Output is correct
18 Correct 2 ms 724 KB Output is correct
19 Correct 1 ms 852 KB Output is correct
20 Correct 1 ms 852 KB Output is correct
21 Correct 1 ms 852 KB Output is correct
22 Correct 2 ms 836 KB Output is correct
23 Correct 1 ms 852 KB Output is correct
24 Correct 1 ms 852 KB Output is correct
25 Correct 2 ms 1112 KB Output is correct
26 Correct 2 ms 1108 KB Output is correct
27 Correct 2 ms 852 KB Output is correct
28 Correct 2 ms 852 KB Output is correct
29 Correct 2 ms 852 KB Output is correct
30 Correct 3 ms 852 KB Output is correct
31 Correct 2 ms 852 KB Output is correct
32 Correct 2 ms 852 KB Output is correct
33 Correct 2 ms 852 KB Output is correct
34 Correct 2 ms 852 KB Output is correct
35 Correct 2 ms 852 KB Output is correct
36 Correct 2 ms 856 KB Output is correct
37 Correct 2 ms 864 KB Output is correct
38 Correct 2 ms 860 KB Output is correct
39 Correct 2 ms 852 KB Output is correct
40 Correct 2 ms 860 KB Output is correct
41 Correct 112 ms 3508 KB Output is correct
42 Correct 84 ms 3616 KB Output is correct
43 Correct 259 ms 6072 KB Output is correct
44 Correct 145 ms 5972 KB Output is correct
45 Correct 416 ms 9328 KB Output is correct
46 Correct 265 ms 9316 KB Output is correct
47 Correct 516 ms 11756 KB Output is correct
48 Correct 333 ms 11852 KB Output is correct
49 Correct 644 ms 14572 KB Output is correct
50 Correct 384 ms 14268 KB Output is correct
51 Correct 840 ms 17604 KB Output is correct
52 Correct 553 ms 17680 KB Output is correct
53 Correct 510 ms 11704 KB Output is correct
54 Correct 514 ms 11812 KB Output is correct
55 Correct 502 ms 11940 KB Output is correct
56 Correct 513 ms 11796 KB Output is correct
57 Correct 512 ms 11824 KB Output is correct
58 Correct 505 ms 11744 KB Output is correct
59 Correct 585 ms 11724 KB Output is correct
60 Correct 497 ms 11972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2601 ms 414468 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -