結果

問題 No.1083 余りの余り
ユーザー southball02southball02
提出日時 2020-06-19 21:26:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,256 bytes
コンパイル時間 1,920 ms
コンパイル使用メモリ 203,200 KB
実行使用メモリ 93,212 KB
最終ジャッジ日時 2023-09-16 13:15:59
合計ジャッジ時間 6,241 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
93,104 KB
testcase_01 AC 46 ms
93,116 KB
testcase_02 AC 47 ms
93,080 KB
testcase_03 AC 47 ms
93,104 KB
testcase_04 WA -
testcase_05 AC 89 ms
93,072 KB
testcase_06 AC 47 ms
93,148 KB
testcase_07 AC 47 ms
93,148 KB
testcase_08 AC 47 ms
93,068 KB
testcase_09 AC 46 ms
93,164 KB
testcase_10 AC 47 ms
93,108 KB
testcase_11 WA -
testcase_12 AC 47 ms
93,120 KB
testcase_13 AC 47 ms
93,152 KB
testcase_14 AC 47 ms
93,064 KB
testcase_15 AC 47 ms
93,100 KB
testcase_16 AC 47 ms
93,072 KB
testcase_17 AC 48 ms
93,148 KB
testcase_18 WA -
testcase_19 AC 89 ms
93,076 KB
testcase_20 AC 48 ms
93,168 KB
testcase_21 AC 52 ms
93,148 KB
testcase_22 AC 47 ms
93,064 KB
testcase_23 AC 227 ms
93,168 KB
testcase_24 AC 227 ms
93,152 KB
testcase_25 AC 226 ms
93,072 KB
testcase_26 AC 227 ms
93,148 KB
testcase_27 AC 48 ms
93,148 KB
testcase_28 WA -
testcase_29 AC 47 ms
93,068 KB
testcase_30 AC 47 ms
93,068 KB
testcase_31 AC 47 ms
93,172 KB
testcase_32 AC 46 ms
93,076 KB
testcase_33 AC 226 ms
93,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n, k; read(n, k);
	vector<int> a(n);
	rep(i, 0, n) read(a[i]);

	vector<vi> dp(21, vi(1<<20, 0));
	dp[0][0] = k;
	rep(i, 0, n) rep(j, 0, 1<<n) if (__builtin_popcount(j)==i) {
		rep(k, 0, n) if (!(j&(1<<k))) chmax(dp[i+1][j|(1<<k)],dp[i][j]%a[k]);
	}
	write(dp[n][(1<<n)-1]);
}
0