結果
問題 | No.1083 余りの余り |
ユーザー |
|
提出日時 | 2022-06-10 09:50:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 494 bytes |
コンパイル時間 | 1,738 ms |
コンパイル使用メモリ | 198,160 KB |
最終ジャッジ日時 | 2025-01-29 19:21:40 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 TLE * 11 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; using namespace std; int main() { cin.tie(0); ios_base::sync_with_stdio(false); int N, K; cin >> N >> K; vector<ll> A(N); rep(i, N) cin >> A[i]; sort(A.begin(), A.end()); ll ans = 0; do { ll cur = K; rep(i, N) cur %= A[i]; ans = max(ans, cur); } while (next_permutation(A.begin(), A.end())); cout << ans << "\n"; return 0; }