結果
| 問題 |
No.1083 余りの余り
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-19 21:25:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 298 bytes |
| コンパイル時間 | 475 ms |
| コンパイル使用メモリ | 67,712 KB |
| 実行使用メモリ | 7,552 KB |
| 最終ジャッジ日時 | 2024-07-03 13:43:51 |
| 合計ジャッジ時間 | 2,005 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 4 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main()
| ^~~~
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
int N,K,A[20];
int dp[1<<20];
main()
{
cin>>N>>K;
for(int i=0;i<N;i++)cin>>A[i];
dp[0]=K;
for(int i=0;i<1<<N;i++)if(dp[i]>0)for(int j=0;j<N;j++)if(!(i>>j&1))
{
dp[i|1<<j]=max(dp[i|1<<j],dp[i]%A[j]);
}
cout<<dp[(1<<N)-1]<<endl;
}