結果
| 問題 |
No.1083 余りの余り
|
| コンテスト | |
| ユーザー |
ate
|
| 提出日時 | 2020-06-19 23:32:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 390 bytes |
| コンパイル時間 | 1,915 ms |
| コンパイル使用メモリ | 197,776 KB |
| 最終ジャッジ日時 | 2025-01-11 08:08:08 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 4 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
signed main(){
int64_t n,k;
cin>>n>>k;
vector<int64_t> a(n);
for(auto& ai:a)cin>>ai;
auto chmax = [](auto& a,auto b){if(a<b)a=b;};
vector dp(1<<n,0ll);
dp[0] = k;
for(int b=0;b<(1<<n);++b){
for(int i=0;i<n;++i){
chmax(dp[b|(1<<i)],dp[b]%a[i]);
}
}
int ans = (1<<n)-1;
ans = dp[ans];
cout<<(ans)<<endl;
}
ate