結果

問題 No.2424 Josouzai
ユーザー ksukegames
提出日時 2023-08-18 23:16:02
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 996 bytes
コンパイル時間 3,340 ms
コンパイル使用メモリ 207,896 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-28 10:06:34
合計ジャッジ時間 6,077 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <utility>
#include <tuple>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cassert>
#include <functional>
#include <numeric>
#include <type_traits>
#include <optional>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#define coutf(f) cout << fixed << setprecision(f)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	sort(all(a));
	ll cnt = 0;
	rep(i, n) {
		cnt += a[i];
		if (cnt >= k) {
			cout << i << " " << k - (cnt - a[i]) << endl;
			return 0;
		}
	}
	cout << n << " " << k - cnt << endl;
	return 0;
}
0