結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー |
👑 ![]() |
提出日時 | 2020-12-01 20:47:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 89 ms / 2,000 ms |
コード長 | 634 bytes |
コンパイル時間 | 1,753 ms |
コンパイル使用メモリ | 194,996 KB |
実行使用メモリ | 27,924 KB |
最終ジャッジ日時 | 2025-06-22 02:43:11 |
合計ジャッジ時間 | 10,819 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
外部呼び出し有り |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 44 RE * 20 TLE * 1 -- * 9 |
ソースコード
#include<bits/stdc++.h> using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0;i<(n);i++) const LL M=998244353; const int Z=1024; int N,K,X,Y; int A[Z]={}; LL dp[Z][Z]; LL buf[Z][Z]; int main(){ cin>>N>>K>>X>>Y; rep(i,K){ int a; cin>>a; A[a]=dp[a][a]=1; } rep(i,N-1){ rep(x,Z){ LL S=0; rep(y,Z) S+=dp[x][y]; rep(y,Z){ if(!A[y]) continue; buf[x^y][y] = S-dp[x][y]; } } rep(x,Z) rep(y,Z){ dp[x][y]=buf[x][y]; buf[x][y]=0; } } LL ans=0; rep(x,Z) rep(y,Z) if(X<=x && x<=Y) ans+=dp[x][y]; ans%=M; cout<<ans<<endl; return 0; }