結果
問題 |
No.1083 余りの余り
|
ユーザー |
|
提出日時 | 2021-02-02 22:44:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 698 bytes |
コンパイル時間 | 1,538 ms |
コンパイル使用メモリ | 179,364 KB |
実行使用メモリ | 814,652 KB |
最終ジャッジ日時 | 2024-06-29 23:55:36 |
合計ジャッジ時間 | 3,479 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 MLE * 1 |
other | -- * 31 |
コンパイルメッセージ
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; | ^
ソースコード
#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; }