結果

問題 No.1083 余りの余り
ユーザー umezo
提出日時 2020-06-19 22:48:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 550 bytes
コンパイル時間 4,375 ms
コンパイル使用メモリ 230,460 KB
最終ジャッジ日時 2025-01-11 07:30:21
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 TLE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

const int MOD=1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,k;
  cin>>n>>k;
  
  vector<int> A(n);
  rep(i,n) cin>>A[i];
  
  vector<int> B(n);
  rep(i,n) B[i]=i;
  
  int max=0;
  int x;
  do{
    x=k;
    rep(i,n){
      x=x%(A[B[i]]);
    }
    if(x>max) max=x;
  }while(next_permutation(ALL(B)));
  
  cout<<max<<endl;
  
  return 0;
}
0