結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー fumofumofunifumofumofuni
提出日時 2020-12-01 14:00:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 379 ms / 2,000 ms
コード長 3,080 bytes
コンパイル時間 2,353 ms
コンパイル使用メモリ 206,112 KB
実行使用メモリ 331,316 KB
最終ジャッジ日時 2023-09-03 03:27:21
合計ジャッジ時間 46,495 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
331,088 KB
testcase_01 AC 130 ms
331,092 KB
testcase_02 AC 131 ms
331,088 KB
testcase_03 AC 137 ms
331,160 KB
testcase_04 AC 136 ms
331,200 KB
testcase_05 AC 131 ms
331,240 KB
testcase_06 AC 129 ms
331,036 KB
testcase_07 AC 136 ms
331,084 KB
testcase_08 AC 146 ms
331,316 KB
testcase_09 AC 134 ms
331,204 KB
testcase_10 AC 133 ms
331,060 KB
testcase_11 AC 137 ms
331,128 KB
testcase_12 AC 131 ms
331,144 KB
testcase_13 AC 129 ms
331,176 KB
testcase_14 AC 131 ms
331,060 KB
testcase_15 AC 130 ms
331,236 KB
testcase_16 AC 132 ms
331,120 KB
testcase_17 AC 165 ms
331,044 KB
testcase_18 AC 130 ms
331,064 KB
testcase_19 AC 129 ms
331,044 KB
testcase_20 AC 130 ms
331,156 KB
testcase_21 AC 379 ms
331,100 KB
testcase_22 AC 132 ms
331,120 KB
testcase_23 AC 132 ms
331,072 KB
testcase_24 AC 139 ms
331,084 KB
testcase_25 AC 133 ms
331,084 KB
testcase_26 AC 144 ms
331,092 KB
testcase_27 AC 155 ms
331,220 KB
testcase_28 AC 136 ms
331,108 KB
testcase_29 AC 136 ms
331,040 KB
testcase_30 AC 133 ms
331,096 KB
testcase_31 AC 129 ms
331,028 KB
testcase_32 AC 156 ms
331,044 KB
testcase_33 AC 130 ms
331,044 KB
testcase_34 AC 154 ms
331,156 KB
testcase_35 AC 133 ms
331,036 KB
testcase_36 AC 132 ms
331,192 KB
testcase_37 AC 131 ms
331,040 KB
testcase_38 AC 129 ms
331,028 KB
testcase_39 AC 131 ms
331,092 KB
testcase_40 AC 132 ms
331,156 KB
testcase_41 AC 129 ms
331,024 KB
testcase_42 AC 132 ms
331,044 KB
testcase_43 AC 135 ms
331,092 KB
testcase_44 AC 131 ms
331,088 KB
04_evil_A_01 RE -
04_evil_A_02 RE -
04_evil_A_03 RE -
04_evil_A_04 RE -
04_evil_A_05 RE -
04_evil_A_06 AC 138 ms
331,092 KB
04_evil_A_07 AC 136 ms
331,372 KB
04_evil_A_08 AC 142 ms
331,144 KB
04_evil_A_09 AC 139 ms
331,136 KB
04_evil_A_10 AC 138 ms
331,364 KB
05_evil_B_01 RE -
05_evil_B_02 RE -
05_evil_B_03 RE -
05_evil_B_04 RE -
05_evil_B_05 RE -
05_evil_B_06 RE -
05_evil_B_07 RE -
05_evil_B_08 RE -
05_evil_B_09 RE -
05_evil_B_10 RE -
06_evil_C_01 RE -
06_evil_C_02 RE -
06_evil_C_03 RE -
06_evil_C_04 RE -
06_evil_C_05 RE -
06_evil_C_06 RE -
06_evil_C_07 RE -
06_evil_C_08 RE -
06_evil_C_09 RE -
06_evil_C_10 AC 133 ms
331,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=(n)-1;i>=0;i--)
#define perl(i,r,l) for(ll i=(r)-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const int mod = MOD9;
const int max_n = 200005;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  bool operator==(const mint &p) const { return x == p.x; }
  bool operator!=(const mint &p) const { return x != p.x; }
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint dp[40][1024][1024];//j=末尾、k=xor;

int main(){
    rep(i,40)rep(j,1024)rep(k,1024)dp[i][j][k]=0;
    ll n,k,x,y;cin >> n >> k >> x >> y;
    set<ll> st;rep(i,k){
        ll p;cin >> p;st.insert(p);
    }

    if(n==2){
        mint ans=0;
        for(auto p:st){
            for(auto q:st){
                if(p==q)continue;
                ll t=p^q;
                if(x<=t&&t<=y)ans+=1;
            }
        }
        cout << ans <<endl;
        return 0;
    }



    for(auto p:st)dp[0][p][p]=1;
    rep(i,n-1){
        for(auto j:st){
            rep(k,1024){
                for(auto p:st){
                    if(j==p)continue;
                    dp[i+1][p][k^p]+=dp[i][j][k];
                }
            }
        }
    }
    mint ans=0;
    rep(j,1024)rep(k,1024){
        if(x<=k&&k<=y)ans+=dp[n-1][j][k];
    }
    cout << ans <<endl;
}
0