結果

問題 No.1083 余りの余り
ユーザー CleyLCleyL
提出日時 2020-01-28 22:21:07
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 62 ms / 3,000 ms
コード長 680 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 83,176 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-15 22:18:21
合計ジャッジ時間 2,166 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 9 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 8 ms
4,380 KB
testcase_19 AC 11 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,384 KB
testcase_23 AC 35 ms
4,380 KB
testcase_24 AC 62 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 4 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 19 ms
4,380 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 11 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//愚直!笑
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <set>
using namespace std;
vector<int> A;
set<int> Nya;
int n,k;
int ans;
void DFS(int nw,int k,int made){
  if(ans >= k)return;
  if(made == 1){
    ans = max(ans,k);
  }
  for(int i = 1; made > i; i++){
    if(Nya.find(i) != Nya.end()){
      continue;
    }
    Nya.insert(i);
    DFS(nw+1,k%A[i-1],i);
    Nya.erase(i);
  }


}
int main(){
  cin>>n>>k;
  assert(20 >= n);
  assert(n >= 1);
  assert(1000000000 >= k);
  assert(k >= 1);
  for(int i = 0; n > i; i++){
    int T;cin>>T;
    A.push_back(T);
  }
  sort(A.begin(),A.end());
  DFS(0,k,n+1);
  cout << ans << endl;
}
0