結果
問題 | No.1083 余りの余り |
ユーザー |
![]() |
提出日時 | 2020-06-20 17:15:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,839 bytes |
コンパイル時間 | 2,430 ms |
コンパイル使用メモリ | 198,168 KB |
最終ジャッジ日時 | 2025-01-11 08:45:27 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 6 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)#define rreps(i, n) for(int i=((int)(n)); i>0; --i)#define all(x) (x).begin(), (x).end()#define rall(x) (x).rbegin(), (x).rend()#define sz(x) ((int)(x).size())#define pl(s) cout << (s) << "\n";#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}#define plexit(s) {cout << (s) << "\n"; exit(0);}#define yes(s) cout << ((s)?"Yes":"No") << "\n";#define pb push_back#define pcnt __builtin_popcountlltemplate<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; }#ifdef __LOCAL#include <dump.hpp>#define dump(...) \DUMPOUT << " " << string(#__VA_ARGS__) << ": " \<< "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" \<< endl \<< " ", \dump_func(__VA_ARGS__)#else#define dump(...)#endifstruct IOInit {static constexpr int IOS_PREC = 15;static constexpr bool AUTOFLUSH = false;IOInit() {cin.tie(nullptr);ios::sync_with_stdio(false);cout << fixed << setprecision(IOS_PREC);dump(IOS_PREC);if(AUTOFLUSH) cout << unitbuf;}} IO_INIT;using i64 = std::int_fast64_t;using i128 = __int128_t;using ll = long long;using ull = unsigned long long;using ld = long double;using pii = std::pair<int, int>;using pll = std::pair<ll, ll>;using vi = std::vector<int>;using vvi = std::vector<vector<int>>;using vl = std::vector<ll>;using vp = std::vector<pii>;constexpr int INFINT = (1 << 30) - 1; // 1.07x10^ 9constexpr int INFINT_LIM = (1LL << 31) - 1; // 2.15x10^ 9constexpr ll INFLL = 1LL << 60; // 1.15x10^18constexpr ll INFLL_LIM = (1LL << 62) - 1 + (1LL << 62); // 9.22x10^18constexpr ld eps = 1e-6;constexpr ll MOD = 1000000007;constexpr ld PI = 3.141592653589793238462643383279;constexpr int dx4[4] = {1, 0, -1, 0};constexpr int dy4[4] = {0, 1, 0, -1};constexpr int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};constexpr int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};signed main(void) {int N, K; cin >> N >> K;vi a(N); rep(i,N) cin >> a[i];sort(all(a));int ans = 0;for(int bit=1; bit<(1<<N); ++bit) {int x = K;rep(i,N) {if ((bit>>i)&1) x %= a[i];}x %= a[0];chmax(ans,x);}pl(ans);return 0;}