結果

問題 No.1083 余りの余り
ユーザー CleyLCleyL
提出日時 2020-01-28 21:58:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 596 bytes
コンパイル時間 811 ms
コンパイル使用メモリ 77,632 KB
実行使用メモリ 10,144 KB
最終ジャッジ日時 2024-04-23 02:23:16
合計ジャッジ時間 5,553 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#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){
  if(ans >= k)return;
  if(nw == n){
    ans = max(ans,k);
  }
  for(int i = 1; n >= i; i++){
    if(Nya.find(i) != Nya.end()){
      continue;
    }
    Nya.insert(i);
    DFS(nw+1,k%A[i-1]);
    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);
  }
  DFS(0,k);
  cout << ans << endl;
}
0