結果

問題 No.1083 余りの余り
ユーザー snrnsidy
提出日時 2021-10-05 01:51:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 2,235 ms
コンパイル使用メモリ 199,036 KB
最終ジャッジ日時 2025-01-24 20:40:12
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 7 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

long long int dp[1<<20][20];

int main(void) 
{
	cin.tie(0);
	ios::sync_with_stdio(false);

  int n,k;
  long long int t;
  vector <long long int> a;
  long long int res = 0;

  cin >> n >> k;

  for(int i=0;i<n;i++)
  {
    cin >> t;
    a.push_back(t);
  }

  sort(a.rbegin(),a.rend());

  for(int i=0;i<(1<<n);i++)
  {
    long long int X = k;
    for(int j=0;j<n;j++)
    {
      if((i&(1<<j))) X%=a[j];
    }
    res = max(res,X);
  }

  cout << res << '\n';
  
  return 0;
}
0