結果
| 問題 |
No.1083 余りの余り
|
| コンテスト | |
| ユーザー |
keijak
|
| 提出日時 | 2020-06-19 21:43:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,221 bytes |
| コンパイル時間 | 3,008 ms |
| コンパイル使用メモリ | 195,888 KB |
| 最終ジャッジ日時 | 2025-01-11 06:00:11 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 14 |
ソースコード
#define DEBUGGING // Enables DEBUG macro.
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)
#ifndef DEBUGGING
#define debug(...)
#define DEBUG(...)
#else
template <typename T>
void debug(T value) {
std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
std::cerr << value << ", ";
debug(args...);
}
#define DEBUG(...) \
do { \
cerr << " (L" << __LINE__ << ") "; \
cerr << #__VA_ARGS__ << ": "; \
debug(__VA_ARGS__); \
cerr << endl; \
} while (0)
#endif
const i64 INF = 1LL << 40;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, K;
cin >> N >> K;
vector<i64> A(N);
i64 mx = INF;
for (auto& x : A) {
cin >> x;
mx = min(mx, x);
}
i64 ans = 0;
auto solve = [&](auto rec, int i, i64 val) -> void {
if (i == N) return;
if (val < mx) {
if (ans < val) ans = val;
return;
}
rec(rec, i + 1, val);
rec(rec, i + 1, val % A[i]);
};
solve(solve, 0, K);
cout << ans << endl;
}
keijak