結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー | fumofumofuni |
提出日時 | 2020-12-01 18:08:38 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 382 ms / 2,000 ms |
コード長 | 4,417 bytes |
コンパイル時間 | 2,224 ms |
コンパイル使用メモリ | 212,428 KB |
実行使用メモリ | 339,456 KB |
最終ジャッジ日時 | 2024-06-12 10:46:31 |
合計ジャッジ時間 | 59,625 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 80 ms
331,096 KB |
testcase_01 | AC | 89 ms
339,344 KB |
testcase_02 | AC | 78 ms
331,096 KB |
testcase_03 | AC | 130 ms
331,120 KB |
testcase_04 | AC | 89 ms
331,132 KB |
testcase_05 | AC | 82 ms
331,156 KB |
testcase_06 | AC | 81 ms
331,284 KB |
testcase_07 | AC | 84 ms
331,220 KB |
testcase_08 | AC | 148 ms
331,092 KB |
testcase_09 | AC | 88 ms
331,172 KB |
testcase_10 | AC | 85 ms
331,156 KB |
testcase_11 | AC | 88 ms
331,136 KB |
testcase_12 | AC | 81 ms
331,160 KB |
testcase_13 | AC | 81 ms
331,200 KB |
testcase_14 | AC | 80 ms
331,216 KB |
testcase_15 | AC | 81 ms
331,136 KB |
testcase_16 | AC | 81 ms
331,200 KB |
testcase_17 | AC | 382 ms
339,456 KB |
testcase_18 | AC | 83 ms
331,112 KB |
testcase_19 | AC | 84 ms
331,124 KB |
testcase_20 | AC | 82 ms
331,004 KB |
testcase_21 | AC | 147 ms
339,376 KB |
testcase_22 | AC | 85 ms
331,096 KB |
testcase_23 | AC | 85 ms
331,148 KB |
testcase_24 | AC | 90 ms
331,076 KB |
testcase_25 | AC | 131 ms
331,104 KB |
testcase_26 | AC | 142 ms
331,164 KB |
testcase_27 | AC | 157 ms
331,184 KB |
testcase_28 | AC | 135 ms
331,112 KB |
testcase_29 | AC | 136 ms
331,100 KB |
testcase_30 | AC | 130 ms
331,152 KB |
testcase_31 | AC | 129 ms
331,108 KB |
testcase_32 | AC | 158 ms
331,160 KB |
testcase_33 | AC | 131 ms
331,180 KB |
testcase_34 | AC | 152 ms
331,180 KB |
testcase_35 | AC | 130 ms
331,148 KB |
testcase_36 | AC | 130 ms
331,052 KB |
testcase_37 | AC | 134 ms
331,084 KB |
testcase_38 | AC | 133 ms
331,104 KB |
testcase_39 | AC | 132 ms
331,128 KB |
testcase_40 | AC | 134 ms
331,108 KB |
testcase_41 | AC | 132 ms
331,156 KB |
testcase_42 | AC | 134 ms
331,240 KB |
testcase_43 | AC | 134 ms
331,052 KB |
testcase_44 | AC | 133 ms
331,152 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 | 87 ms
331,180 KB |
04_evil_A_07 | AC | 89 ms
331,232 KB |
04_evil_A_08 | AC | 89 ms
331,188 KB |
04_evil_A_09 | AC | 88 ms
331,268 KB |
04_evil_A_10 | AC | 88 ms
331,140 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 | 130 ms
331,056 KB |
ソースコード
#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(){ 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; } if(n==4){ ll ans=0; /*mint ep[n+1][1024];rep(i,n+1)rep(j,1024)ep[i][j]=0; ep[0][0]=1; rep(i,4)rep(j,1024)for(auto p:st)ep[i+1][j^p]+=ep[i][j];*/ vector<vector<ll>> store(1024,vector<ll>(1024,0));//key:xor,val[i]:要素 vector<ll> tot(1024);//key:xor,val[i]:要素 for(auto p:st){ for(auto q:st){ if(p==q)continue; ll t=p^q; store[t][q]+=1; tot[t]+=1; //if(x<=t&&t<=y)ans+=1; } } rep(i,1024){ if(i<x||i>y)continue; rep(j,1024){ ll com=i^j; if(com>j)continue; ll ret=0; ret+=tot[com]*tot[j]; rep(z,1024)ret-=store[com][z]*store[j][z]; if(com<j)ret*=2; ans+=ret; } } cout << ans%MOD9 <<endl; return 0; //map<ll,vl> mp;//key:xor,val[i]:要素 //map<ll,ll> tot;//key:xor,val[i]:要素 //rep(j,10)cout << ep[n][j] <<endl; /*rep(i,1024)if(x<=i&&i<=y)ans+=ep[4][i]; rep(i,1024)if(x<=i&&i<=y)ans-=ep[2][i]*3*st.size(); rep(i,1024)if(x<=i&&i<=y)ans+=ep[2][i]*2; if(x==0)ans-=st.size(); cout << ans <<endl;*/ return 0; } rep(i,40)rep(j,1024)rep(k,1024)dp[i][j][k]=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; }