結果

問題 No.1083 余りの余り
ユーザー MayimgMayimg
提出日時 2020-07-03 19:50:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 658 bytes
コンパイル時間 2,463 ms
コンパイル使用メモリ 204,148 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-10-15 03:31:39
合計ジャッジ時間 4,410 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 13 ms
4,348 KB
testcase_06 AC 2 ms
4,356 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 1 ms
4,356 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 1 ms
4,352 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 2 ms
4,352 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 12 ms
4,356 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 3 ms
4,356 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 49 ms
4,348 KB
testcase_24 WA -
testcase_25 AC 48 ms
4,348 KB
testcase_26 AC 48 ms
4,352 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 2 ms
4,352 KB
testcase_30 AC 2 ms
4,352 KB
testcase_31 AC 2 ms
4,352 KB
testcase_32 AC 2 ms
4,356 KB
testcase_33 AC 24 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> in(n);
  int mi = 1 << 30;
  for (int i = 0; i < n; i++) {
    cin >> in[i];
    mi = min(mi, in[i]);
  }
  vector<int> a;
  for (int i = 0; i < n; i++) {
    if (in[i] > mi) a.push_back(in[i]);
  }
  sort(a.begin(), a.end());
  n = a.size();
  int ans = 0;
  for (int mask = 0; mask < (1 << n); mask++) {
    int cur = k;
    for (int i = 0; i < n; i++) {
      if ((mask >> i) & 1) cur %= a[i];
    }
    cur %= mi;
    ans = max(ans, cur);
  }
  cout << ans << endl;
  return 0;
}
0