提出番号 | 2377 |
---|---|

提出者 | kya |

言語 | C++ |

提出日時 | 2020-04-27 22:42:23 |

問題名 | (68)単位 |

結果 | AC |

点数 | 100% |

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

```
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n);
for (int &e : a) cin >> e;
sort(a.begin(), a.end(), greater<int>());
int val = 0, ans = n;
for (int i = 0; i < n; i++) {
if (m <= val) ans = min(ans, i);
val += a[i];
}
cout << ans << '\n';
return 0;
}
```