結果

問題 No.1083 余りの余り
コンテスト
ユーザー SSRS
提出日時 2020-06-19 23:24:35
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 433 bytes
コンパイル時間 1,598 ms
コンパイル使用メモリ 173,156 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-03 15:48:52
合計ジャッジ時間 2,468 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 7 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  random_device rnd;
  mt19937 mt(rnd());
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  int ans = K;
  for (int i = 0; i < 10000; i++){
    vector<int> B = A;
    shuffle(B.begin(), B.end(), mt);
    int X = K;
    for (int j = 0; j < N; j++){
      X %= B[j];
    }
    ans = max(ans, X);
  }
  cout << ans << endl;
}
0