結果
問題 | No.1083 余りの余り |
ユーザー |
![]() |
提出日時 | 2020-06-19 21:43:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 627 bytes |
コンパイル時間 | 698 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-07-03 14:11:51 |
合計ジャッジ時間 | 3,154 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 4 |
ソースコード
#include <iostream> #include <algorithm> #include <iomanip> #include <vector> #include <queue> #include <set> #include <map> using namespace std; typedef long long ll; int N; ll A[20]; ll dp[1<<20]; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int K; cin >> N >> K; dp[0] = K; for(int j = 0; j < N; j++) cin >> A[j]; for(int i = 0; i < (1<<N); i++){ for(int j = 0; j < N; j++){ ll m = (ll)1<<j; if(m&i) continue; dp[i|m] = max(dp[i|m], dp[i]%A[j]); } } cout << dp[((ll)1<<N)-1] << endl; }