Submission #965628

# Submission time Handle Problem Language Result Execution time Memory
965628 2024-04-19T03:20:35 Z 12345678 Let's Win the Election (JOI22_ho_t3) C++17
10 / 100
27 ms 512 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=505;

#define int long double

int n, k;
vector<pair<int, int>> v;
int cost, res=DBL_MAX;

int32_t main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>k;
    v.resize(n);
    for (int i=0; i<n; i++) 
    {
        cin>>v[i].second>>v[i].first;
        if (v[i].first==-1) v[i].first=1e9;
    }
    sort(v.begin(), v.end());
    for (int i=0; i<k; i++)
    {
        vector<int> t;
        for (int j=i; j<n; j++) t.push_back(v[j].second);
        sort(t.begin(), t.end());
        int tmp=cost;
        //cout<<tmp<<'\n';
        for (int j=0; j<k-i; j++) tmp+=(t[j])/(1+i);
        //cout<<i<<' '<<tmp<<'\n';
        res=min(res, tmp);
        cost+=(v[i].first)/(1+i);
    }
    cout<<fixed<<setprecision(12)<<res;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 9 ms 496 KB Output is correct
7 Correct 15 ms 344 KB Output is correct
8 Correct 19 ms 500 KB Output is correct
9 Correct 20 ms 348 KB Output is correct
10 Correct 18 ms 500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 9 ms 496 KB Output is correct
7 Correct 15 ms 344 KB Output is correct
8 Correct 19 ms 500 KB Output is correct
9 Correct 20 ms 348 KB Output is correct
10 Correct 18 ms 500 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 11 ms 348 KB Output is correct
13 Correct 12 ms 348 KB Output is correct
14 Correct 11 ms 348 KB Output is correct
15 Correct 18 ms 492 KB Output is correct
16 Correct 20 ms 348 KB Output is correct
17 Correct 22 ms 496 KB Output is correct
18 Correct 20 ms 348 KB Output is correct
19 Correct 22 ms 348 KB Output is correct
20 Correct 21 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 9 ms 496 KB Output is correct
7 Correct 15 ms 344 KB Output is correct
8 Correct 19 ms 500 KB Output is correct
9 Correct 20 ms 348 KB Output is correct
10 Correct 18 ms 500 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 11 ms 348 KB Output is correct
13 Correct 12 ms 348 KB Output is correct
14 Correct 11 ms 348 KB Output is correct
15 Correct 18 ms 492 KB Output is correct
16 Correct 20 ms 348 KB Output is correct
17 Correct 22 ms 496 KB Output is correct
18 Correct 20 ms 348 KB Output is correct
19 Correct 22 ms 348 KB Output is correct
20 Correct 21 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 512 KB Output is correct
29 Incorrect 0 ms 348 KB Output isn't correct
30 Halted 0 ms 0 KB -