結果
問題 | No.1083 余りの余り |
ユーザー |
|
提出日時 | 2020-09-06 17:20:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 119 ms / 3,000 ms |
コード長 | 494 bytes |
コンパイル時間 | 2,159 ms |
コンパイル使用メモリ | 199,740 KB |
最終ジャッジ日時 | 2025-01-14 07:54:28 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define REP(i,n) for(int i=0; i<(int)(n); i++)int main() {ios_base::sync_with_stdio(0);cin.tie(0);int n, k;cin >> n >> k;vector<int> a(n);REP (i, n) cin >> a[i];sort(a.rbegin(), a.rend());int ret = 0;REP (mask, 1<<n) {if (mask) {int x = k;REP (i, n) {if (mask & 1<<i)x %= a[i];}ret = max(ret, x % a.back());}}cout << ret << endl;return 0;}