結果

問題 No.2424 Josouzai
ユーザー kt_soupkt_soup
提出日時 2023-08-18 21:05:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 337 bytes
コンパイル時間 644 ms
コンパイル使用メモリ 75,088 KB
実行使用メモリ 6,656 KB
最終ジャッジ日時 2024-05-06 02:35:26
合計ジャッジ時間 3,337 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 25 ms
5,376 KB
testcase_05 AC 95 ms
6,400 KB
testcase_06 AC 83 ms
6,528 KB
testcase_07 AC 84 ms
6,400 KB
testcase_08 AC 91 ms
6,656 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 22 ms
5,376 KB
testcase_11 AC 61 ms
6,016 KB
testcase_12 AC 44 ms
5,376 KB
testcase_13 AC 27 ms
5,376 KB
testcase_14 AC 48 ms
5,376 KB
testcase_15 AC 8 ms
5,376 KB
testcase_16 AC 78 ms
5,888 KB
testcase_17 AC 21 ms
5,376 KB
testcase_18 AC 24 ms
5,376 KB
testcase_19 AC 42 ms
5,376 KB
testcase_20 AC 81 ms
6,144 KB
testcase_21 AC 63 ms
5,376 KB
testcase_22 AC 28 ms
5,376 KB
testcase_23 AC 34 ms
5,376 KB
testcase_24 AC 15 ms
5,376 KB
testcase_25 AC 85 ms
6,272 KB
testcase_26 AC 60 ms
5,376 KB
testcase_27 AC 87 ms
6,272 KB
testcase_28 AC 73 ms
5,760 KB
testcase_29 AC 65 ms
5,504 KB
testcase_30 AC 16 ms
5,376 KB
testcase_31 AC 39 ms
5,376 KB
testcase_32 AC 84 ms
6,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
  int N,K;
  cin >> N >> K;
  vector<long long> A(N),s(N+1,0);
  for(int i=0;i<N;i++)cin >> A[i];
  sort(A.begin(),A.end());
  for(int i=0;i<N;i++)s[i+1] = s[i] + A[i];
  int i = 1;
  for(;s[i]<=K;i++);
  cout << i-1 << ' ' << K-s[i-1] << endl;
}
0