답안 #678005

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
678005 2023-01-05T01:25:30 Z owoovo Let's Win the Election (JOI22_ho_t3) C++14
10 / 100
1304 ms 1004476 KB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
double dp[510][510][510];//i:use j:contru k:need
vector<pair<double,double>> ori;
int main(){
    double ans=10000000;
    ll n,k,u=0;
    cin>>n>>k;
    for(ll i=1;i<=n;i++){
        double a,b;
        cin>>a>>b;
        if(b==-1){
            ori.push_back(make_pair(10000000,a));
        }else{
            u++;
            ori.push_back(make_pair(b,a));
        }
    }
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            for(int k=0;k<=n;k++){
                dp[i][j][k]=10000000;
            }
        }
    }
    dp[0][0][0]=0;
    sort(ori.begin(),ori.end());
    for(int need=0;need<=u;need++){
        for(int i=1;i<=n;i++){
            if(i<=need){
                dp[i][i][0]=dp[i-1][i-1][0];
                for(int j=1;j<=need;j++){
                    dp[i][i][j]=min(dp[i][i][j],dp[i-1][i-1][j]+ori[i-1].second/(need+1));
                    dp[i][i][j]=min(dp[i][i][j],dp[i-1][i-1][j-1]+ori[i-1].first/j);
                }
            }else{
                //dp[i][0][need]=dp[i-1][0][need];
                for(int j=1;j<=k;j++){
                    dp[i][j][need]=min(min(dp[i][j][need],dp[i-1][j][need]),dp[i-1][j-1][need]+ori[i-1].second/(need+1));
                }
            }
        }
        ans=min(ans,dp[n][k][need]);
    }
    cout<<fixed<<ans<<'\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 441 ms 1004344 KB Output is correct
6 Correct 454 ms 1004376 KB Output is correct
7 Correct 394 ms 1004264 KB Output is correct
8 Correct 391 ms 1004336 KB Output is correct
9 Correct 407 ms 1004348 KB Output is correct
10 Correct 392 ms 1004264 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 441 ms 1004344 KB Output is correct
6 Correct 454 ms 1004376 KB Output is correct
7 Correct 394 ms 1004264 KB Output is correct
8 Correct 391 ms 1004336 KB Output is correct
9 Correct 407 ms 1004348 KB Output is correct
10 Correct 392 ms 1004264 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 648 ms 1004348 KB Output is correct
13 Correct 541 ms 1004288 KB Output is correct
14 Correct 470 ms 1004244 KB Output is correct
15 Correct 990 ms 1004408 KB Output is correct
16 Correct 807 ms 1004440 KB Output is correct
17 Correct 578 ms 1004476 KB Output is correct
18 Correct 1251 ms 1004340 KB Output is correct
19 Correct 1045 ms 1004364 KB Output is correct
20 Correct 660 ms 1004240 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1304 ms 1004336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 441 ms 1004344 KB Output is correct
6 Correct 454 ms 1004376 KB Output is correct
7 Correct 394 ms 1004264 KB Output is correct
8 Correct 391 ms 1004336 KB Output is correct
9 Correct 407 ms 1004348 KB Output is correct
10 Correct 392 ms 1004264 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 648 ms 1004348 KB Output is correct
13 Correct 541 ms 1004288 KB Output is correct
14 Correct 470 ms 1004244 KB Output is correct
15 Correct 990 ms 1004408 KB Output is correct
16 Correct 807 ms 1004440 KB Output is correct
17 Correct 578 ms 1004476 KB Output is correct
18 Correct 1251 ms 1004340 KB Output is correct
19 Correct 1045 ms 1004364 KB Output is correct
20 Correct 660 ms 1004240 KB Output is correct
21 Incorrect 1 ms 468 KB Output isn't correct
22 Halted 0 ms 0 KB -