結果

問題 No.1083 余りの余り
ユーザー mfbgjsczmfbgjscz
提出日時 2020-12-29 00:43:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,447 bytes
コンパイル時間 2,077 ms
コンパイル使用メモリ 199,292 KB
実行使用メモリ 18,076 KB
最終ジャッジ日時 2024-04-15 00:11:50
合計ジャッジ時間 11,385 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define ll long long
#define INF 9999999999999999
#define rep(i, m, n) for (int i = m; i < n; i++)
#define rrep(i, m, n) for (int i = m - 1; i >= n; i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(), N.end()), N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(), n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K, L, N, S) vector<L> K(N, S)
#define DV(K, L, N, M, S) vector<vector<L>> K(N, vector<L>(M, S))
#define TV(K, L, N, M, R, S) \
    vector<vector<vector<L>>> K(N, vector<vector<L>>(M, vector<L>(R, S)))
#define pint pair<ll, ll>
#define tint tuple<int, int, int>
#define paf(L, R) pair<L, R>
#define mod 1000000007
#define MAX 10000010
#define ALL(a) a.begin(), a.end()
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, 0, N) cin >> A[i];
    vector<ll> dp(1 << N, 0); //dp[S] := {S}の全ての要素を使ったとき余りの最大値
    dp[0] = K;
    rep(i, 0, N) rep(bit, 0, 1 << N) rep(j, 0, N) chmax(dp[bit | 1 << j], dp[bit] % A[j]);
    cout << dp[(1 << N) - 1] << endl;
} 
0