编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#12092 #129. 贿赂程基会长 Accepted 100 641 ms 6592 K C++ 17 / 979 B 220021101054 2023-11-18 1:46:31
显示原始代码
#include <iostream>
#include <iomanip>
#include <algorithm>
#define int long long


using namespace std;

const int N = 2e5 + 10;

struct node {
    int f;
    double v;
} a[2 * N];
int n, k, s;
int cnt, x;
double y, ans;

bool cmp(node x, node y) { return x.v > y.v; }

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> k >> s;
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        cin >> x >> y;
        if (x > k) {
            a[cnt++] = { k, y };
            a[cnt++] = { x - k, y * 0.5 };
        } else
            a[cnt++] = { x, y };
    }
    sort(a, a + cnt, cmp);
    for (int i = 0; i < cnt; i++) {
        if (s > a[i].f) {
            ans += a[i].f * a[i].v;
            s -= a[i].f;
        } else {
            ans += s * a[i].v;
            break;
        }
    }
    cout << fixed << setprecision(1) << ans << endl;
    return 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:3 ms
内存:284 KiB

输入文件(1.in

3 2 5
6 1
3 2
1 8

答案文件(1.out

14.0

用户输出

14.0

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:78 ms
内存:3564 KiB

输入文件(2.in

200000 196278 184476
4 71769
1 80981
3 52592
2 51245
3 92838
4 11124
1 31249
4 94098
1 4354
<1777523 bytes omitted>

答案文件(2.out

15595936121.0

用户输出

15595936121.0

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:113 ms
内存:6592 KiB

输入文件(3.in

200000 1 128797
1013 47567
3249 53991
7257 8721
4633 7331
4107 22283
2511 83125
8905 90229
1
<2355567 bytes omitted>

答案文件(3.out

8927236582.5

用户输出

8927236582.5

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:107 ms
内存:6152 KiB

输入文件(4.in

200000 1083 190843
2135 50635
8259 70563
3359 13579
9453 47829
9783 46909
7951 54663
8071 208
<2355345 bytes omitted>

答案文件(4.out

19075642841.0

用户输出

19075642841.0

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:41 ms
内存:1868 KiB

输入文件(5.in

100000 1 50133
1 52153
1 31533
1 50091
1 90649
1 60311
1 42232
1 89139
1 31580
1 25093
1 3
<888994 bytes omitted>

答案文件(5.out

3764283308.0

用户输出

3764283308.0

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:80 ms
内存:3456 KiB

输入文件(6.in

200000 1 200000
1 3061
1 86710
1 67773
1 38726
1 92942
1 3598
1 39043
1 2828
1 15545
1 295
<1777875 bytes omitted>

答案文件(6.out

9999775589.0

用户输出

9999775589.0

系统信息

Exited with return code 0
测试点 #7
Accepted
得分:100
用时:112 ms
内存:6528 KiB

输入文件(7.in

200000 1 157553
8619 72891
7313 59289
155 26325
2961 78903
5451 24141
5007 5585
4227 36017
1
<2355292 bytes omitted>

答案文件(7.out

10387694817.5

用户输出

10387694817.5

系统信息

Exited with return code 0
测试点 #8
Accepted
得分:100
用时:107 ms
内存:5928 KiB

输入文件(8.in

200000 1935 107037
3245 47757
2265 95693
3735 15415
7693 68107
7413 27931
323 47467
5961 9023
<2355631 bytes omitted>

答案文件(8.out

10702525561.0

用户输出

10702525561.0

系统信息

Exited with return code 0