結果
問題 |
No.1083 余りの余り
|
ユーザー |
|
提出日時 | 2020-06-19 21:56:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,464 bytes |
コンパイル時間 | 1,693 ms |
コンパイル使用メモリ | 171,988 KB |
実行使用メモリ | 13,880 KB |
最終ジャッジ日時 | 2024-07-03 14:26:04 |
合計ジャッジ時間 | 6,107 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 TLE * 1 -- * 28 |
ソースコード
#include <bits/stdc++.h> #define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i)) #define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i)) #define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i)) #define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i)) #define REP(i, n) FOR((i), 0, (n)) #define REPe(i, n) FORe((i), 1, (n)) #define REPo(i, n) FORe((i), 0, (n)) #define rREP(i, n) rFOR((i), 0, (n)) #define rREPe(i, n) rFORe((i), 1, (n)) #define rREPo(i, n) rFORe((i), 0, (n)) #define rep(i, n) FOR((i), 0, (n)) #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define fi first #define se second #define dup(x, y) (((x)+(y)-1)/(y)) #define vc(T) vector<T> #define vv(T) v(v(T)) using namespace std; using ll = long long; using P = pair<int,int>; using pll = pair<ll,ll>; using T = tuple<int,int,int>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vs = vector<string>; using vp = vector<P>; using vt = vector<T>; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } int main() { int n, k; cin>>n>>k; vi a(n); REP(i, n) cin>>a[i]; sort(all(a)); int ans = 0; do { int tmp = k; REP(i, n) tmp %= a[i]; chmax(ans, tmp); }while (next_permutation(all(a))); cout << ans << endl; return 0; }