結果

問題 No.1083 余りの余り
ユーザー 👑 deuteridayodeuteridayo
提出日時 2021-02-02 22:44:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 698 bytes
コンパイル時間 1,693 ms
コンパイル使用メモリ 177,684 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-12 11:26:36
合計ジャッジ時間 16,677 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 TLE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:14:12: 警告: ‘n’ is used uninitialized [-Wuninitialized]
   14 |     int a[n];
      |            ^
main.cpp:13:9: 備考: ‘n’ はここで宣言されています
   13 |     int n,k;
      |         ^

ソースコード

diff #

#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