提出 #54165249


ソースコード 拡げる

#include <bits/stdc++.h>
#define fr first
#define sc second
#define all(a) (a).begin(), (a).end()

using namespace std;

#ifdef ONPC
mt19937 rnd(223);
#else
mt19937 rnd(chrono::high_resolution_clock::now()
            .time_since_epoch().count());
#endif

#define TIME (clock() * 1.0 / CLOCKS_PER_SEC)

using ll = long long;
using ld = double;

const ll llinf = 1e18 + 100;

const int maxn = 1e5 + 100, inf = 1e9 + 100;

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int &i : a)
        cin >> i;
    sort(all(a));
    if (k <= 0) {
        reverse(all(a));
        if (accumulate(all(a), 0ll) < k) {
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
    for (int i : a)
        cout << i << ' ';
}

int main() {
#ifdef ONPC
    freopen("../a.in", "r", stdin);
    freopen("../a.out", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed;
    cout.precision(20);
    solve();
    cerr << "\n\nConsumed " << TIME << endl;
}

提出情報

提出日時
問題 A - Partition
ユーザ grumpy_gordon
言語 C++ 20 (gcc 12.2)
得点 300
コード長 1074 Byte
結果 AC
実行時間 30 ms
メモリ 4012 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 48
セット名 テストケース
Sample 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt
All 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt, 01-handmade-001.txt, 01-handmade-002.txt, 01-handmade-003.txt, 01-handmade-004.txt, 01-handmade-005.txt, 01-handmade-006.txt, 01-handmade-007.txt, 01-handmade-008.txt, 01-handmade-009.txt, 01-handmade-010.txt, 01-handmade-011.txt, 01-handmade-012.txt, 01-handmade-013.txt, 01-handmade-014.txt, 01-handmade-015.txt, 01-handmade-016.txt, 01-handmade-017.txt, 01-handmade-018.txt, 01-handmade-019.txt, 01-handmade-020.txt, 01-handmade-021.txt, 01-handmade-022.txt, 01-handmade-023.txt, 01-handmade-024.txt, 01-handmade-025.txt, 02-random-001.txt, 02-random-002.txt, 02-random-003.txt, 02-random-004.txt, 02-random-005.txt, 02-random-006.txt, 02-random-007.txt, 02-random-008.txt, 02-random-009.txt, 02-random-010.txt, 02-random-011.txt, 02-random-012.txt, 02-random-013.txt, 02-random-014.txt, 02-random-015.txt, 02-random-016.txt, 02-random-017.txt, 02-random-018.txt, 02-random-019.txt, 02-random-020.txt
ケース名 結果 実行時間 メモリ
00-sample-001.txt AC 1 ms 3780 KiB
00-sample-002.txt AC 1 ms 3936 KiB
00-sample-003.txt AC 1 ms 3780 KiB
01-handmade-001.txt AC 1 ms 3848 KiB
01-handmade-002.txt AC 1 ms 3896 KiB
01-handmade-003.txt AC 1 ms 3840 KiB
01-handmade-004.txt AC 1 ms 4008 KiB
01-handmade-005.txt AC 1 ms 3904 KiB
01-handmade-006.txt AC 1 ms 3852 KiB
01-handmade-007.txt AC 1 ms 3900 KiB
01-handmade-008.txt AC 1 ms 3844 KiB
01-handmade-009.txt AC 1 ms 3852 KiB
01-handmade-010.txt AC 1 ms 3852 KiB
01-handmade-011.txt AC 1 ms 3932 KiB
01-handmade-012.txt AC 1 ms 3712 KiB
01-handmade-013.txt AC 1 ms 3844 KiB
01-handmade-014.txt AC 1 ms 3852 KiB
01-handmade-015.txt AC 23 ms 3944 KiB
01-handmade-016.txt AC 14 ms 3900 KiB
01-handmade-017.txt AC 25 ms 3908 KiB
01-handmade-018.txt AC 12 ms 3944 KiB
01-handmade-019.txt AC 24 ms 3904 KiB
01-handmade-020.txt AC 17 ms 3916 KiB
01-handmade-021.txt AC 12 ms 3912 KiB
01-handmade-022.txt AC 10 ms 3948 KiB
01-handmade-023.txt AC 15 ms 3852 KiB
01-handmade-024.txt AC 30 ms 3944 KiB
01-handmade-025.txt AC 28 ms 3944 KiB
02-random-001.txt AC 1 ms 4008 KiB
02-random-002.txt AC 1 ms 3864 KiB
02-random-003.txt AC 1 ms 3948 KiB
02-random-004.txt AC 1 ms 3908 KiB
02-random-005.txt AC 1 ms 3940 KiB
02-random-006.txt AC 1 ms 3764 KiB
02-random-007.txt AC 1 ms 3896 KiB
02-random-008.txt AC 1 ms 3716 KiB
02-random-009.txt AC 1 ms 3908 KiB
02-random-010.txt AC 1 ms 3720 KiB
02-random-011.txt AC 17 ms 4012 KiB
02-random-012.txt AC 10 ms 3852 KiB
02-random-013.txt AC 30 ms 3912 KiB
02-random-014.txt AC 17 ms 3852 KiB
02-random-015.txt AC 7 ms 3756 KiB
02-random-016.txt AC 3 ms 3948 KiB
02-random-017.txt AC 6 ms 3716 KiB
02-random-018.txt AC 11 ms 3860 KiB
02-random-019.txt AC 19 ms 3860 KiB
02-random-020.txt AC 28 ms 3860 KiB