結果
| 問題 |
No.1083 余りの余り
|
| コンテスト | |
| ユーザー |
shinchan
|
| 提出日時 | 2020-06-25 10:36:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 654 bytes |
| コンパイル時間 | 1,853 ms |
| コンパイル使用メモリ | 194,260 KB |
| 最終ジャッジ日時 | 2025-01-11 10:07:26 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 4 |
ソースコード
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
int main() {
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
ll n, k;
cin >> n >> k;
ll a[n];
for(int i=0;i<n;i++){
cin >> a[i];
}
ll maki = 1LL << n;
vector<ll> dp(maki, 0);
dp[0] = k;
for(int i=1;i<maki;i++){
for(int j=0;j<n;j++) if(i>>j & 1){
dp[i] = max(dp[i], dp[i-(1<<j)] % a[j]);
}
}
cout << dp[maki - 1] << endl;
return 0;
}
shinchan