結果
問題 | No.1083 余りの余り |
ユーザー |
👑 |
提出日時 | 2020-01-28 22:13:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 679 bytes |
コンパイル時間 | 847 ms |
コンパイル使用メモリ | 83,604 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 01:44:47 |
合計ジャッジ時間 | 2,091 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 WA * 3 |
ソースコード
//愚直!笑 #include <iostream> #include <algorithm> #include <vector> #include <cassert> #include <set> using namespace std; vector<int> A; set<int> Nya; int n,k; int ans; void DFS(int nw,int k,int made){ if(ans >= k)return; if(made == 1){ ans = max(ans,k); } for(int i = 1; made >= i; i++){ if(Nya.find(i) != Nya.end()){ continue; } Nya.insert(i); DFS(nw+1,k%A[i-1],i); Nya.erase(i); } } int main(){ cin>>n>>k; assert(20 >= n); assert(n >= 1); assert(1000000000 >= k); assert(k >= 1); for(int i = 0; n > i; i++){ int T;cin>>T; A.push_back(T); } sort(A.begin(),A.end()); DFS(0,k,n); cout << ans << endl; }