結果
| 問題 | No.1083 余りの余り |
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2021-04-30 03:51:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 3,000 ms |
| コード長 | 540 bytes |
| 記録 | |
| コンパイル時間 | 4,182 ms |
| コンパイル使用メモリ | 341,932 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 03:35:35 |
| 合計ジャッジ時間 | 5,516 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace mp=boost::multiprecision;
int main(){
int N,K;
cin>>N>>K;
vector<int> A(N);
for(int i=0;i<N;++i){
cin>>A[i];
}
sort(A.begin(),A.end(),[](int a,int b){return a>b;});
int temp,ans=0;
for(int i=(1<<(N-1));i<(1<<N);i++){
temp=K;
for(int j=0;j<N;j++){
if(i&(1<<j)){
temp=temp%A[j];
}
}
ans=max(ans,temp);
}
cout<<ans<<endl;
}
ytft