結果

問題 No.3758 Fan Meeting
コンテスト
ユーザー テナガザル
提出日時 2026-10-09 21:46:30
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 505 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,025 ms
コンパイル使用メモリ 175,952 KB
実行使用メモリ 9,900 KB
最終ジャッジ日時 2026-10-09 21:46:37
合計ジャッジ時間 4,465 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.rbegin(), a.rend());
  if (a[0] >= s)
  {
    cout << a[0] << endl;
    return 0;
  }
  int ans = n;
  for (int i = 1; i < n; ++i)
  {
    long long nok = s;
    for (int j = 0; j < n; j += i)
    {
      nok -= a[j];
    }
    if (nok > 0)
    {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}
0