Submission #923482

# Submission time Handle Problem Language Result Execution time Memory
923482 2024-02-07T10:18:36 Z heeheeheehaaw Let's Win the Election (JOI22_ho_t3) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

struct oras
{
    int a, b;
};

oras v[505];
typedef long double ld;

bool cmp2(oras a, oras b)
{
    return a.a < b.a;
}

bool cmp1(oras a, oras b)
{
    return a.b < b.b;
}

int main()
{
    int n, k;
    cin>>n>>k;
    ld minn = 0.0;
    for(int i = 1; i <= n; i++)
    {
        cin>>v[i].a>>v[i].b, minn += (ld)v[i].a;
        if(v[i].b == -1) v[i].b = 1e6;
    }

    for(int cnt = 0; cnt <= k; cnt++)
    {
        sort(v + 1, v + n + 1, cmp1);
        ld rez = 0.0;
        for(int i = 1; i <= cnt; i++)
            rez += (ld)v[i].b / (ld)i;
        if(cnt != k)
        {
            sort(v + cnt + 1, v + n + 1, cmp2);
            for(int i = cnt + 1; i <= k; i++)
                rez += (ld)v[i].a / (ld)(cnt + 1);
        }

        minn = min(minn, rez);
    }

    cout<<fixed<<setprecision(10);
    cout<<minn;
    return 0;
}

Compilation message

cc1plus: error: '::main' must return 'int'