結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー chocoruskchocorusk
提出日時 2020-12-01 12:33:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,636 bytes
コンパイル時間 1,549 ms
コンパイル使用メモリ 138,940 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-03 03:24:02
合計ジャッジ時間 5,830 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
04_evil_A_01 -- -
04_evil_A_02 -- -
04_evil_A_03 -- -
04_evil_A_04 -- -
04_evil_A_05 -- -
04_evil_A_06 -- -
04_evil_A_07 -- -
04_evil_A_08 -- -
04_evil_A_09 -- -
04_evil_A_10 -- -
05_evil_B_01 -- -
05_evil_B_02 -- -
05_evil_B_03 -- -
05_evil_B_04 -- -
05_evil_B_05 -- -
05_evil_B_06 -- -
05_evil_B_07 -- -
05_evil_B_08 -- -
05_evil_B_09 -- -
05_evil_B_10 -- -
06_evil_C_01 -- -
06_evil_C_02 -- -
06_evil_C_03 -- -
06_evil_C_04 -- -
06_evil_C_05 -- -
06_evil_C_06 -- -
06_evil_C_07 -- -
06_evil_C_08 -- -
06_evil_C_09 -- -
06_evil_C_10 -- -
権限があれば一括ダウンロードができます

ソースコード

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(n);
    for(int i=0; i<k; i++){
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    a.erase(unique(a.begin(), a.end()));
    k=a.size();
    const ll MOD=998244353;
    auto dfs=[&](auto dfs, int s, int t, int m, vector<ll> &c){
        if(m==n/2){
            c[s]++;
            return;
        }
        for(int i=0; i<k; i++){
            if(i==t) continue;
            dfs(dfs, s^a[i], i, m+1, c);
        }
    };
    vector<ll> v(1024);
    vector<ll> vc[1024];
    for(int i=0; i<k; i++){
        vc[i].resize(1024);
        dfs(dfs, a[i], i, 0, vc[i]);
        for(auto j:v) v[j]+=vc[i][j];
    }
    ll ans=0;
    for(int i=0; i<1024; i++) for(int j=0; j<1024; j++) if((i^j)>=x && (i^j)<=y) ans+=v[i]*v[j];
    for(int i=0; i<k; i++){
        for(int j=0; j<1024; j++) for(int l=0; l<=j; l++){
            if((j^l)>=x && (j^l)<=y){
                if(j==l) ans-=vc[i][j]*vc[i][l];
                else ans-=vc[i][j]*vc[i][l]*2;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
0