답안 #528144

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
528144 2022-02-19T12:22:12 Z doowey Let's Win the Election (JOI22_ho_t3) C++14
10 / 100
10 ms 356 KB
#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = 505;


int main(){
    fastIO;
    //freopen("in.txt","r",stdin);
    int n, k;
    cin >> n >> k;
    vector<pair<ld,ld>> C(n);
    for(int i = 0 ; i < n; i ++ ){
        cin >> C[i].se >> C[i].fi;
        if(C[i].fi == -1) C[i].fi = (ld)1000000;
    }
    sort(C.begin(), C.end());
    ld S0 = 0;
    ld res = (ld)1e8;
    ld S;
    for(int i = 0 ; i <= k ; i ++ ){
        if(i) S0 += (C[i - 1].fi / ld(i));
        vector<ld> A;
        for(int j = i; j < n; j ++ ){
            A.push_back(C[j].se);
        }
        sort(A.begin(), A.end());
        S = 0;
        for(int j = 0;  j < k - i; j ++ ){
            S += A[j] / ld(i + 1);
        }
        res = min(res, S + S0);
    }
    cout << fixed << setprecision(9) << res << "\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
8 Correct 6 ms 332 KB Output is correct
9 Correct 4 ms 332 KB Output is correct
10 Correct 4 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
8 Correct 6 ms 332 KB Output is correct
9 Correct 4 ms 332 KB Output is correct
10 Correct 4 ms 332 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 4 ms 356 KB Output is correct
14 Correct 4 ms 332 KB Output is correct
15 Correct 4 ms 332 KB Output is correct
16 Correct 6 ms 348 KB Output is correct
17 Correct 6 ms 352 KB Output is correct
18 Correct 5 ms 352 KB Output is correct
19 Correct 7 ms 332 KB Output is correct
20 Correct 6 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Incorrect 1 ms 204 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Incorrect 1 ms 204 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Incorrect 1 ms 204 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
8 Correct 6 ms 332 KB Output is correct
9 Correct 4 ms 332 KB Output is correct
10 Correct 4 ms 332 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 4 ms 356 KB Output is correct
14 Correct 4 ms 332 KB Output is correct
15 Correct 4 ms 332 KB Output is correct
16 Correct 6 ms 348 KB Output is correct
17 Correct 6 ms 352 KB Output is correct
18 Correct 5 ms 352 KB Output is correct
19 Correct 7 ms 332 KB Output is correct
20 Correct 6 ms 332 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Incorrect 1 ms 204 KB Output isn't correct
30 Halted 0 ms 0 KB -