結果

問題 No.1083 余りの余り
コンテスト
ユーザー deuteridayo
提出日時 2021-02-02 22:44:52
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
RE  
実行時間 -
コード長 698 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,289 ms
コンパイル使用メモリ 192,596 KB
実行使用メモリ 60,672 KB
最終ジャッジ日時 2026-03-19 15:35:55
合計ジャッジ時間 4,904 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1 RE * 2
other AC * 2 WA * 5 RE * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:14:12: warning: 'n' is used uninitialized [-Wuninitialized]
   14 |     int a[n];
      |            ^
main.cpp:13:9: note: 'n' declared here
   13 |     int n,k;
      |         ^

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
// #include<atcoder/all>
using namespace std;
// using namespace atcoder;
using lint = long long;
using graph = vector<vector<int>>;
#define endl '\n'
lint const mod = 1e9+7;
//long const mod = 998244353;


int main(){
    int n,k;
    int a[n];
    cin >> n >> k;
    for(int i=0;i<n;i++)cin >> a[i];
    int ans = 0;
    sort(a,a+n);
    vector<unordered_set<int>>dp(1<<n);
    queue<int>que;
    que.push(0);
    dp[0].insert(k);
    for(int bit = 1;bit< (1<<k);bit+=2){
        int tmp = k;
        for(int i=k-1;k>=0;k--){
            if(bit & (1<<i)){
                tmp %= a[i];
            }
        }
        ans  = max(ans,tmp);
    }
    cout << ans << endl;
}

0