結果
問題 |
No.868 ハイパー部分和問題
|
ユーザー |
![]() |
提出日時 | 2019-08-16 22:58:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 634 bytes |
コンパイル時間 | 961 ms |
コンパイル使用メモリ | 96,192 KB |
実行使用メモリ | 13,888 KB |
最終ジャッジ日時 | 2024-09-22 20:34:00 |
合計ジャッジ時間 | 9,743 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | AC * 14 TLE * 1 -- * 23 |
ソースコード
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <cmath> #include <map> #include <queue> #include <iomanip> #include <set> #include <bitset> #define MOD 1000000007 #define mkp make_pair typedef long long ll; using namespace std; int N,K,Q; int main(){ cin>>N>>K; vector<int> A(N); for(int i=0;i<N;i++) cin>>A[i]; cin>>Q; for(int q=0;q<Q;q++){ int x,y; cin>>x>>y; x--; A[x]=y; bitset<15000+1> dp; dp.set(0); for(int i=0;i<N;i++){ dp|=(dp<<A[i]); } if(dp[K]) cout<<1<<endl; else cout<<0<<endl; } return 0; }