結果

問題 No.1083 余りの余り
ユーザー warabi0906warabi0906
提出日時 2023-02-06 13:22:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,425 bytes
コンパイル時間 3,732 ms
コンパイル使用メモリ 227,516 KB
実行使用メモリ 11,448 KB
最終ジャッジ日時 2023-09-18 01:03:04
合計ジャッジ時間 6,858 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include "atcoder/all"
#define debug cout << "OK" << endl;
template<typename T>
inline bool chmax(T& a, const T b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
inline bool chmin(T& a, const T b) { if (a > b) { a = b; return true; } return false; }
inline int Code(char c) {
	if ('A' <= c and c <= 'Z')return (int)(c - 'A');
	if ('a' <= c and c <= 'z')return (int)(c - 'a');
	if ('0' <= c and c <= '9')return (int)(c - '0');
	assert(false);
}
using namespace std;
using namespace atcoder;
#define int long long
constexpr int MOD = 998244353;
constexpr int INF = (1LL << 62);
using minit = modint998244353;

template<typename T>
ostream& operator << (ostream& st, const vector<T> &v) {
	for (const T value : v) {
		st << value << " ";
	}
	return st;
}
template<typename T>
istream& operator >> (istream& st, vector<T>& v) {
	for (T &value : v) {
		st >> value;
	}
	return st;
}

//
typedef struct {
	int to, cost;
}edge;
//

void solve() {
	//#1 入力
	int N, K;
	cin >> N >> K;
	vector<int> A(N);
	cin >> A;

	//#2 bitDP
	vector<int> DP(1 << N, -1);
	DP[0] = K;
	for (int bit = 0; bit < (1ll << N) - 1; bit++) {
		for (int i = 0; i < N; i++) {
			if (bit & (1ll << i))continue;
			chmax(DP[bit | (1ll << i)], DP[bit] % A[i]);
		}
	}

	//#3 出力
	cout << DP.back() << endl;
}
signed main() {
	int T = 1;
	// cin >> T;
	for (int i = 0; i < T; i++)
		solve();
	return 0;
}
0