답안 #992034

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
992034 2024-06-03T16:13:37 Z Otalp Let's Win the Election (JOI22_ho_t3) C++14
56 / 100
2500 ms 15192 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define pii pair<int, int>
#define ff first
#define ss second
#define ld long double
#define pb push_back

pair<ld, ld> a[300100];
ll b[300100];
ll us[300100];
ll n, m;
ld dp[600][600], ob[600][600];


bool cmp(int x, int y){
    return a[x].ss < a[y].ss;
}

bool cmp2(pair<ld, ld> a, pair<ld, ld> b){
    return a.ss < b.ss;
}

void solve(){
    cin>>n>>m;
    int cnt = 0;
    vector<int> q;
    for(int i=1; i<=n; i++){
        cin>>a[i].ff>>a[i].ss;
        if(a[i].ss == -1) a[i].ss = 1e9;
        else cnt ++; 
    }
    sort(a + 1, a + 1 + n, cmp2);
    ld ans = 1e18;
    for(int D=0; D<=n; D++){
        for(int i=0; i<=n; i++){
            for(int j=0; j<=n; j++){
                dp[i][j] = ob[i][j] =   1e9;
            }
        }
        dp[0][0] = 0;
        for(int i=1; i<=n; i++){
            for(int d=0; d<=n; d++){
                for(int k=0; k<=n; k++){
                    ob[d][k] = min(ob[d][k], dp[d][k]);
                    ob[d][k + 1] = min(ob[d][k + 1], dp[d][k] + a[i].ff / (D + 1));
                    if(a[i].ss != 1e9) ob[d + 1][k + 1] = min(ob[d + 1][k + 1], dp[d][k] + a[i].ss / (d + 1));
                }
            }
            
            for(int i=0; i<=n; i++){
                for(int j=0; j<=n; j++){
                    dp[i][j] = ob[i][j];
                    ob[i][j] = 1e9;
                }
            }
        }
        ans = min(ans, dp[D][m]);

    }
    cout<<fixed<<setprecision(9)<<ans<<'\n';
}


signed main(){
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6596 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Execution timed out 2592 ms 14940 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6596 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Execution timed out 2592 ms 14940 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6744 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 1 ms 6492 KB Output is correct
15 Correct 1 ms 6492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6744 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 1 ms 6492 KB Output is correct
15 Correct 1 ms 6492 KB Output is correct
16 Correct 5 ms 8540 KB Output is correct
17 Correct 5 ms 8540 KB Output is correct
18 Correct 4 ms 8540 KB Output is correct
19 Correct 5 ms 8656 KB Output is correct
20 Correct 4 ms 8740 KB Output is correct
21 Correct 4 ms 8540 KB Output is correct
22 Correct 5 ms 8540 KB Output is correct
23 Correct 5 ms 8612 KB Output is correct
24 Correct 4 ms 8536 KB Output is correct
25 Correct 5 ms 8540 KB Output is correct
26 Correct 6 ms 8540 KB Output is correct
27 Correct 6 ms 8540 KB Output is correct
28 Correct 6 ms 8540 KB Output is correct
29 Correct 5 ms 8540 KB Output is correct
30 Correct 4 ms 8540 KB Output is correct
31 Correct 5 ms 8536 KB Output is correct
32 Correct 5 ms 8624 KB Output is correct
33 Correct 4 ms 8540 KB Output is correct
34 Correct 5 ms 8536 KB Output is correct
35 Correct 5 ms 8540 KB Output is correct
36 Correct 4 ms 8540 KB Output is correct
37 Correct 4 ms 8540 KB Output is correct
38 Correct 5 ms 8736 KB Output is correct
39 Correct 5 ms 8644 KB Output is correct
40 Correct 5 ms 8744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6744 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 1 ms 6492 KB Output is correct
15 Correct 1 ms 6492 KB Output is correct
16 Correct 5 ms 8540 KB Output is correct
17 Correct 5 ms 8540 KB Output is correct
18 Correct 4 ms 8540 KB Output is correct
19 Correct 5 ms 8656 KB Output is correct
20 Correct 4 ms 8740 KB Output is correct
21 Correct 4 ms 8540 KB Output is correct
22 Correct 5 ms 8540 KB Output is correct
23 Correct 5 ms 8612 KB Output is correct
24 Correct 4 ms 8536 KB Output is correct
25 Correct 5 ms 8540 KB Output is correct
26 Correct 6 ms 8540 KB Output is correct
27 Correct 6 ms 8540 KB Output is correct
28 Correct 6 ms 8540 KB Output is correct
29 Correct 5 ms 8540 KB Output is correct
30 Correct 4 ms 8540 KB Output is correct
31 Correct 5 ms 8536 KB Output is correct
32 Correct 5 ms 8624 KB Output is correct
33 Correct 4 ms 8540 KB Output is correct
34 Correct 5 ms 8536 KB Output is correct
35 Correct 5 ms 8540 KB Output is correct
36 Correct 4 ms 8540 KB Output is correct
37 Correct 4 ms 8540 KB Output is correct
38 Correct 5 ms 8736 KB Output is correct
39 Correct 5 ms 8644 KB Output is correct
40 Correct 5 ms 8744 KB Output is correct
41 Correct 2105 ms 10792 KB Output is correct
42 Correct 1970 ms 10588 KB Output is correct
43 Correct 2041 ms 10792 KB Output is correct
44 Correct 1986 ms 10788 KB Output is correct
45 Correct 2020 ms 10792 KB Output is correct
46 Correct 1978 ms 10588 KB Output is correct
47 Correct 1999 ms 10792 KB Output is correct
48 Correct 1947 ms 10588 KB Output is correct
49 Correct 2013 ms 10796 KB Output is correct
50 Correct 1940 ms 10796 KB Output is correct
51 Correct 2065 ms 10588 KB Output is correct
52 Correct 1955 ms 10796 KB Output is correct
53 Correct 2055 ms 10588 KB Output is correct
54 Correct 2033 ms 10588 KB Output is correct
55 Correct 2037 ms 10844 KB Output is correct
56 Correct 2024 ms 10800 KB Output is correct
57 Correct 2072 ms 10792 KB Output is correct
58 Correct 2033 ms 10792 KB Output is correct
59 Correct 2021 ms 10588 KB Output is correct
60 Correct 2062 ms 10792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2529 ms 15192 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6596 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Execution timed out 2592 ms 14940 KB Time limit exceeded
6 Halted 0 ms 0 KB -