結果

問題 No.1083 余りの余り
ユーザー KKT89KKT89
提出日時 2020-06-19 21:48:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 811 bytes
コンパイル時間 1,167 ms
コンパイル使用メモリ 111,020 KB
実行使用メモリ 723,404 KB
最終ジャッジ日時 2023-09-16 13:52:57
合計ジャッジ時間 14,247 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
56,864 KB
testcase_01 AC 20 ms
52,800 KB
testcase_02 AC 20 ms
52,552 KB
testcase_03 AC 19 ms
52,600 KB
testcase_04 AC 22 ms
52,892 KB
testcase_05 AC 1,341 ms
187,608 KB
testcase_06 AC 20 ms
52,496 KB
testcase_07 AC 20 ms
52,672 KB
testcase_08 AC 20 ms
52,660 KB
testcase_09 AC 20 ms
52,768 KB
testcase_10 AC 20 ms
52,796 KB
testcase_11 AC 20 ms
52,584 KB
testcase_12 AC 20 ms
52,540 KB
testcase_13 AC 20 ms
52,536 KB
testcase_14 AC 20 ms
52,560 KB
testcase_15 AC 20 ms
52,596 KB
testcase_16 AC 20 ms
52,520 KB
testcase_17 AC 21 ms
52,492 KB
testcase_18 AC 1,511 ms
210,744 KB
testcase_19 AC 314 ms
91,276 KB
testcase_20 AC 26 ms
53,728 KB
testcase_21 AC 31 ms
54,040 KB
testcase_22 AC 20 ms
52,820 KB
testcase_23 TLE -
testcase_24 MLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <deque>
#include <cstdio>
#include <queue>
#include <numeric>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

set<int> dp[1<<20];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    ll k; cin >> k;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    a.erase(unique(a.begin(), a.end()),a.end());
    dp[0].insert(k);
    for(int i=0;i<(1<<n);i++){
        for(int j=0;j<n;j++){
            if(i&(1<<j))continue;
            for(auto s:dp[i]){
                dp[i+(1<<j)].insert(s%a[j]);
            }
        }
    }
    cout << *dp[(1<<n)-1].rbegin() << endl;
}
0