結果
問題 | No.2424 Josouzai |
ユーザー |
![]() |
提出日時 | 2023-08-22 11:20:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 507 bytes |
コンパイル時間 | 511 ms |
コンパイル使用メモリ | 44,612 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-16 07:43:37 |
合計ジャッジ時間 | 2,691 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
/* -*- coding: utf-8 -*-** 2424.cc: No.2424 Josouzai - yukicoder*/#include<cstdio>#include<algorithm>using namespace std;/* constant */const int MAX_N = 200000;/* typedef *//* global variables */int as[MAX_N];/* subroutines *//* main */int main() {int n, k;scanf("%d%d", &n, &k);for (int i = 0; i < n; i++) scanf("%d", as + i);sort(as, as + n);int c = 0;for (int i = 0; i < n && k >= as[i]; i++)c++, k -= as[i];printf("%d %d\n", c, k);return 0;}