답안 #891883

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
891883 2023-12-24T10:42:43 Z 8pete8 Let's Win the Election (JOI22_ho_t3) C++17
10 / 100
823 ms 5204 KB
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<float.h>
#include<limits.h>
#include <cassert>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric> //gcd(a,b)
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define endl "\n"
#define s second
#define pii pair<int,int>
#define ppii pair<pii,int>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-loops")
using namespace std;
//#define int long long
#define double long double
//const int mod=998244353,mxn=2e5+5,lg=30,inf=1e9,minf=-1e9,Mxn=100000;
//bool use[mxn+10];
double dp[600][600];
int32_t main(){
    fastio
    int n,k;cin>>n>>k;
    double ans=LDBL_MAX;
    vector<pii>v(n);
    for(int i=0;i<n;i++){
        cin>>v[i].f>>v[i].s;
        v[i].s=(v[i].s==-1)?1e9:v[i].s;
        swap(v[i].s,v[i].f);
    }
    sort(all(v));
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)dp[i][j]=LDBL_MAX;
    dp[0][0]=0;
    for(int i=0;i<n;i++){
        for(int j=n;j>=0;j--){
            for(int g=k;g>=0;g--){
                dp[j][g+1]=min(dp[j][g+1],dp[j][g]+(v[i].s*1.0)/(j+1));
                if(v[i].f!=1e9)dp[j+1][g+1]=min(dp[j+1][g+1],dp[j][g]+(v[i].f*1.0)/(j+1));
            }
        }
    }
    for(int j=0;j<=n;j++)ans=min(ans,dp[j][k]);
    cout<<setprecision(12);
    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 38 ms 5176 KB Output is correct
6 Correct 94 ms 5148 KB Output is correct
7 Correct 178 ms 4952 KB Output is correct
8 Correct 267 ms 5172 KB Output is correct
9 Correct 350 ms 5152 KB Output is correct
10 Correct 247 ms 5148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 38 ms 5176 KB Output is correct
6 Correct 94 ms 5148 KB Output is correct
7 Correct 178 ms 4952 KB Output is correct
8 Correct 267 ms 5172 KB Output is correct
9 Correct 350 ms 5152 KB Output is correct
10 Correct 247 ms 5148 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 249 ms 4956 KB Output is correct
13 Correct 192 ms 5152 KB Output is correct
14 Correct 136 ms 4952 KB Output is correct
15 Correct 571 ms 4952 KB Output is correct
16 Correct 442 ms 5156 KB Output is correct
17 Correct 312 ms 5152 KB Output is correct
18 Correct 821 ms 5156 KB Output is correct
19 Correct 639 ms 5164 KB Output is correct
20 Correct 438 ms 5204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 823 ms 5160 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 38 ms 5176 KB Output is correct
6 Correct 94 ms 5148 KB Output is correct
7 Correct 178 ms 4952 KB Output is correct
8 Correct 267 ms 5172 KB Output is correct
9 Correct 350 ms 5152 KB Output is correct
10 Correct 247 ms 5148 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 249 ms 4956 KB Output is correct
13 Correct 192 ms 5152 KB Output is correct
14 Correct 136 ms 4952 KB Output is correct
15 Correct 571 ms 4952 KB Output is correct
16 Correct 442 ms 5156 KB Output is correct
17 Correct 312 ms 5152 KB Output is correct
18 Correct 821 ms 5156 KB Output is correct
19 Correct 639 ms 5164 KB Output is correct
20 Correct 438 ms 5204 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Incorrect 0 ms 348 KB Output isn't correct
30 Halted 0 ms 0 KB -