結果
問題 |
No.1304 あなたは基本が何か知っていますか?私は知っています.
|
ユーザー |
![]() |
提出日時 | 2020-12-01 02:48:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 671 bytes |
コンパイル時間 | 1,815 ms |
コンパイル使用メモリ | 200,332 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-22 02:28:49 |
合計ジャッジ時間 | 11,981 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 45 RE * 29 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; const ll MOD=998244353; ll dp[45][1030]; int main(){ ll n,k,x,y; cin>>n>>k>>x>>y; set<ll> s; rep(i,k){ ll c; cin>>c; s.insert(c); } ll u=s.size(); dp[0][0]=1; for(int i=1;i<=n;i++){ for(int j=0;j<1024;j++){ if(i==2 && j==0) continue; for(auto t:s){ dp[i][j]=(dp[i][j]+dp[i-1][j^t])%MOD; } if(i>2) dp[i][j]=(dp[i][j]-dp[i-2][j]*(u-1)%MOD+MOD)%MOD; } } ll sum=0; for(int i=x;i<=y;i++) sum=(sum+dp[n][i])%MOD; cout<<sum<<endl; return 0; }