結果
問題 | No.1083 余りの余り |
ユーザー |
![]() |
提出日時 | 2020-06-19 21:37:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 64 ms / 3,000 ms |
コード長 | 543 bytes |
コンパイル時間 | 3,095 ms |
コンパイル使用メモリ | 196,496 KB |
最終ジャッジ日時 | 2025-01-11 05:55:04 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;template <class T> using vec = vector<T>;template <class T> using vvec = vector<vec<T>>;int main(){cin.tie(0);ios::sync_with_stdio(false);int N,K;cin >> N >> K;vec<int> A(N);for(auto& x:A) cin >> x;sort(A.begin(),A.end(),greater<int>());int ans = 0;for(int S=1;S<(1<<N);S++) if((S>>(N-1))&1){int now = K;for(int i=0;i<N;i++) if(S>>i&1) now %= A[i];ans = max(ans,now);}cout << ans << "\n";}