编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#19882 #2036. 蓝桥杯 Accepted 100 268 ms 1212 K C++ 17 / 1.5 K admin 2024-12-01 20:50:51
显示原始代码
#ifdef ONLINE_JUDGE
#pragma GCC optimize(2, "Ofast", "inline")
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define rt return

#define pi pair<int, int>

#define pl pair<ll, ll>

#define pu pair<ull, ull>

#define int long long

#define ll long long

#define ull unsigned long long

#define endl '\n'

#define Endl endl

#define all(x) x.begin(), x.end()

#define all1(x) next(x.begin()), x.end()

#define lll __int128_t

#define ulll __uint128_t

using namespace std;
const int64_t maxn = 1e5;
const int64_t mod = 998244353;
const int64_t maxl = (int64_t)(1e18);
const int64_t maxi = 1e9 + 7;
void init() {}
void solve() {
    int n, k, y;
    cin >> n >> k >> y;
    assert(1 <= n && 1 <= k && maxn >= n && maxn >= k && n >= k && y <= maxl && y >= -maxl);
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        assert(a[i] >= -maxl && a[i] <= maxl);
    }
    sort(all1(a), greater<int>());
    lll ans = 0;
    for (int i = 1; i <= k; i++) {
        if (a[i] > 0)
            ans += a[i];
    }
    if (ans >= y) {
        cout << "Yes" << endl;
    } else
        cout << "No" << endl;
}
signed main() {
#ifndef ONLINE_JUDGE
    freopen("1.txt", "r", stdin);
    freopen("2.txt", "w", stdout);
#endif
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    int __ = 1;
    // std::cin >> __;
    init();
    while (__--) {
        solve();
        // cerr<<"TIME"<<qq-__<<endl;
    }
    return 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:4 ms
内存:320 KiB

输入文件(0.in

3 2 10
4 0 6

答案文件(0.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

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

输入文件(1.in

3 2 10
4 8 6

答案文件(1.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

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

输入文件(2.in

3 2 10
4 0 5

答案文件(2.out

No

用户输出

No

Special Judge 信息

Accepted!

系统信息

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

输入文件(3.in

3 1 10
4 8 6

答案文件(3.out

No

用户输出

No

Special Judge 信息

Accepted!

系统信息

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

输入文件(4.in

3 2 -1
-1 -1 -100000000000

答案文件(4.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

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

输入文件(5.in

3 2 10
1 1 1

答案文件(5.out

No

用户输出

No

Special Judge 信息

Accepted!

系统信息

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

输入文件(6.in

10 10 1000000000000000000
1000000000000000000 1000000000000000000 1000000000000000000 1000000000000
<126 bytes omitted>

答案文件(6.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

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

输入文件(7.in

100000 100000 -1000000000000000000
999999999999999999 999999999999999998 999999999999999997 9999999
<1899937 bytes omitted>

答案文件(7.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

Exited with return code 0
测试点 #9
Accepted
得分:100
用时:24 ms
内存:1184 KiB

输入文件(8.in

100000 100000 1000000000000000000
999999999999999999 999999999999999998 999999999999999997 99999999
<1899936 bytes omitted>

答案文件(8.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

Exited with return code 0
测试点 #10
Accepted
得分:100
用时:32 ms
内存:1092 KiB

输入文件(9.in

100000 17500 -902453319573581986
220568132319119820 -606006309927785772 221817482777749182 -7792985
<1938812 bytes omitted>

答案文件(9.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

Exited with return code 0
测试点 #11
Accepted
得分:100
用时:31 ms
内存:1092 KiB

输入文件(10.in

100000 59746 -894671582265816580
-492208032683319612 -226878609136481601 -306800644502256962 374974
<1938701 bytes omitted>

答案文件(10.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

Exited with return code 0
测试点 #12
Accepted
得分:100
用时:32 ms
内存:1100 KiB

输入文件(11.in

100000 71769 -777852166203488646
-326987560522471833 -887811703858463716 -665171390765756268 -50175
<1988850 bytes omitted>

答案文件(11.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

Exited with return code 0
测试点 #13
Accepted
得分:100
用时:31 ms
内存:1212 KiB

输入文件(12.in

100000 75403 -224443883563768932
-965803835834204200 -547463733508387122 -215638566770371317 -99723
<1988848 bytes omitted>

答案文件(12.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

Exited with return code 0
测试点 #14
Accepted
得分:100
用时:30 ms
内存:1092 KiB

输入文件(13.in

100000 59735 -908335187949265337
-244688300138684379 -860666135504880809 -159325669831553934 -60417
<1988874 bytes omitted>

答案文件(13.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

Exited with return code 0
测试点 #15
Accepted
得分:100
用时:31 ms
内存:1180 KiB

输入文件(14.in

100000 80663 -828251309966719903
-427151939844345409 -795520490352793691 -364901579229946334 -92688
<1988882 bytes omitted>

答案文件(14.out

Yes

用户输出

Yes

Special Judge 信息

Accepted!

系统信息

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

输入文件(15.in

10 10 1000000000000000000
-1000000000000000000 -1000000000000000000 -1000000000000000000 -100000000
<136 bytes omitted>

答案文件(15.out

No

用户输出

No

Special Judge 信息

Accepted!

系统信息

Exited with return code 0