提出番号 | 2411 |
---|---|

提出者 | Example |

言語 | C++ |

提出日時 | 2020-09-11 17:52:24 |

問題名 | (68)単位 |

結果 | AC |

点数 | 100% |

テストケース | 結果 | 得点 | 実行時間 | メモリ使用量 |
---|---|---|---|---|

1 | AC | 100% | 2ms | 8112KB |

2 | AC | 100% | 2ms | 8560KB |

3 | AC | 100% | 2ms | 7904KB |

4 | AC | 100% | 2ms | 8544KB |

5 | AC | 100% | 2ms | 7920KB |

6 | AC | 100% | 2ms | 8512KB |

7 | AC | 100% | 2ms | 8112KB |

8 | AC | 100% | 2ms | 7600KB |

9 | AC | 100% | 2ms | 8112KB |

10 | AC | 100% | 2ms | 8464KB |

11 | AC | 100% | 2ms | 8112KB |

12 | AC | 100% | 2ms | 7904KB |

13 | AC | 100% | 2ms | 7904KB |

14 | AC | 100% | 2ms | 8496KB |

15 | AC | 100% | 2ms | 8096KB |

16 | AC | 100% | 2ms | 7904KB |

17 | AC | 100% | 2ms | 8560KB |

18 | AC | 100% | 2ms | 7952KB |

19 | AC | 100% | 2ms | 7904KB |

20 | AC | 100% | 2ms | 7888KB |

21 | AC | 100% | 2ms | 7888KB |

22 | AC | 100% | 2ms | 8096KB |

23 | AC | 100% | 2ms | 7856KB |

24 | AC | 100% | 2ms | 7712KB |

25 | AC | 100% | 2ms | 8112KB |

26 | AC | 100% | 2ms | 7872KB |

27 | AC | 100% | 2ms | 8112KB |

28 | AC | 100% | 2ms | 7856KB |

29 | AC | 100% | 2ms | 8544KB |

30 | AC | 100% | 2ms | 7616KB |

31 | AC | 100% | 2ms | 7856KB |

32 | AC | 100% | 2ms | 8464KB |

33 | AC | 100% | 2ms | 7728KB |

34 | AC | 100% | 2ms | 8096KB |

35 | AC | 100% | 2ms | 8544KB |

36 | AC | 100% | 2ms | 8096KB |

37 | AC | 100% | 2ms | 8544KB |

38 | AC | 100% | 2ms | 7872KB |

39 | AC | 100% | 2ms | 7584KB |

40 | AC | 100% | 2ms | 7872KB |

41 | AC | 100% | 2ms | 8496KB |

42 | AC | 100% | 2ms | 7600KB |

43 | AC | 100% | 2ms | 7616KB |

44 | AC | 100% | 2ms | 7872KB |

45 | AC | 100% | 2ms | 8112KB |

46 | AC | 100% | 2ms | 8512KB |

47 | AC | 100% | 2ms | 7888KB |

48 | AC | 100% | 2ms | 8096KB |

49 | AC | 100% | 2ms | 7904KB |

50 | AC | 100% | 2ms | 8112KB |

51 | AC | 100% | 2ms | 7872KB |

52 | AC | 100% | 2ms | 8448KB |

53 | AC | 100% | 2ms | 7904KB |

54 | AC | 100% | 2ms | 8464KB |

55 | AC | 100% | 2ms | 7904KB |

56 | AC | 100% | 2ms | 7840KB |

57 | AC | 100% | 2ms | 7616KB |

58 | AC | 100% | 2ms | 7920KB |

59 | AC | 100% | 2ms | 7712KB |

60 | AC | 100% | 2ms | 8464KB |

```
#include "bits/stdc++.h"
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
ll INF = (1LL << 60);
signed main() {
int N, M; cin >> N >> M;
vector<int>A(N); for (int i = 0; i < N; i++)cin >> A[i];
sort(A.rbegin(), A.rend());
int cnt = 0;
if (cnt >= M) {
cout << 0 << endl; return 0;
}
for (int i = 0; i < N; i++) {
cnt += A[i];
if (cnt >= M) {
cout << i + 1 << endl; return 0;
}
}
return 0;
}
```