結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー chocorusk
提出日時 2020-12-01 19:29:28
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 1,593 bytes
コンパイル時間 1,195 ms
コンパイル使用メモリ 133,152 KB
実行使用メモリ 19,968 KB
最終ジャッジ日時 2025-06-22 02:41:30
合計ジャッジ時間 11,441 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 44 RE * 20 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
    int n, k, x, y;
    cin>>n>>k>>x>>y;
    vector<int> a(k);
    for(int i=0; i<k; i++){
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    a.erase(unique(a.begin(), a.end()), a.end());
    k=a.size();
    const ll MOD=998244353;
    ll dp[1<<10][1<<10]={};
    for(int i=0; i<k; i++){
        dp[a[i]][i]=1;
    }
    for(int i=0; i<n-1; i++){
        ll dps[1<<10]={};
        for(int j=0; j<(1<<10); j++){
            for(int l=0; l<k; l++){
                dps[j]+=dp[j][l];
            }
        }
        ll dp2[1<<10][1<<10]={};
        for(int j=0; j<(1<<10); j++){
            for(int l=0; l<k; l++){
                dp2[j^a[l]][l]+=dps[j];
            }
        }
        for(int j=0; j<(1<<10); j++){
            for(int l=0; l<k; l++){
                dp2[j^a[l]][l]-=dp[j][l];
            }
        }
        swap(dp, dp2);
    }
    ll ans=0;
    for(int i=x; i<=min(y, (1<<10)-1); i++){
        for(int j=0; j<k; j++){
            ans+=dp[i][j];
        }
    }
    cout<<ans%MOD<<endl;
    return 0;
}
0