結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー kotatsugamekotatsugame
提出日時 2020-12-01 10:28:06
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 3,197 bytes
コンパイル時間 1,069 ms
コンパイル使用メモリ 82,256 KB
実行使用メモリ 787,668 KB
最終ジャッジ日時 2023-09-03 03:21:41
合計ジャッジ時間 64,194 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 AC 1 ms
8,760 KB
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 AC 7 ms
14,680 KB
testcase_09 AC 3 ms
8,744 KB
testcase_10 AC 2 ms
7,532 KB
testcase_11 AC 2 ms
7,628 KB
testcase_12 AC 2 ms
7,596 KB
testcase_13 AC 1 ms
7,644 KB
testcase_14 AC 2 ms
7,604 KB
testcase_15 AC 2 ms
7,584 KB
testcase_16 AC 2 ms
7,632 KB
testcase_17 AC 4 ms
8,740 KB
testcase_18 AC 2 ms
7,456 KB
testcase_19 AC 2 ms
8,748 KB
testcase_20 AC 1 ms
7,532 KB
testcase_21 AC 4 ms
8,744 KB
testcase_22 AC 3 ms
7,724 KB
testcase_23 AC 3 ms
8,748 KB
testcase_24 AC 4 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 6 ms
4,376 KB
testcase_27 AC 10 ms
4,380 KB
testcase_28 AC 3 ms
4,380 KB
testcase_29 AC 4 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 11 ms
4,380 KB
testcase_33 AC 2 ms
4,384 KB
testcase_34 AC 9 ms
4,380 KB
testcase_35 AC 3 ms
4,380 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 1 ms
4,376 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 2 ms
4,384 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 2 ms
4,380 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 5 ms
4,380 KB
04_evil_A_07 AC 4 ms
4,376 KB
04_evil_A_08 AC 4 ms
4,384 KB
04_evil_A_09 AC 3 ms
4,376 KB
04_evil_A_10 AC 4 ms
4,380 KB
05_evil_B_01 TLE -
05_evil_B_02 TLE -
05_evil_B_03 TLE -
05_evil_B_04 TLE -
05_evil_B_05 TLE -
05_evil_B_06 TLE -
05_evil_B_07 TLE -
05_evil_B_08 TLE -
05_evil_B_09 MLE -
05_evil_B_10 MLE -
06_evil_C_01 TLE -
06_evil_C_02 TLE -
06_evil_C_03 TLE -
06_evil_C_04 TLE -
06_evil_C_05 TLE -
06_evil_C_06 TLE -
06_evil_C_07 TLE -
06_evil_C_08 TLE -
06_evil_C_09 TLE -
06_evil_C_10 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
a.cpp:9:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]

ソースコード

diff #

#line 1 "a.cpp"
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#line 3 "/home/kotatsugame/library/math/modint.cpp"
#include<utility>
template<int m>
struct modint{
	unsigned int x;
	constexpr modint()noexcept:x(){}
	template<typename T>
	constexpr modint(T x_)noexcept:x((x_%=m)<0?x_+m:x_){}
	constexpr unsigned int val()const noexcept{return x;}
	constexpr modint&operator++()noexcept{if(++x==m)x=0;return*this;}
	constexpr modint&operator--()noexcept{if(x==0)x=m;--x;return*this;}
	constexpr modint operator++(int)noexcept{modint res=*this;++*this;return res;}
	constexpr modint operator--(int)noexcept{modint res=*this;--*this;return res;}
	constexpr modint&operator+=(const modint&a)noexcept{x+=a.x;if(x>=m)x-=m;return*this;}
	constexpr modint&operator-=(const modint&a)noexcept{if(x<a.x)x+=m;x-=a.x;return*this;}
	constexpr modint&operator*=(const modint&a)noexcept{x=(unsigned long long)x*a.x%m;return*this;}
	constexpr modint&operator/=(const modint&a)noexcept{return*this*=a.inv();}
	constexpr modint operator+()const noexcept{return*this;}
	constexpr modint operator-()const noexcept{return modint()-*this;}
	constexpr modint pow(long long n)const noexcept
	{
		if(n<0)return pow(-n).inv();
		modint x=*this,r=1;
		for(;n;x*=x,n>>=1)if(n&1)r*=x;
		return r;
	}
	constexpr modint inv()const noexcept
	{
		int s=x,t=m,x=1,u=0;
		while(t)
		{
			int k=s/t;
			s-=k*t;
			swap(s,t);
			x-=k*u;
			swap(x,u);
		}
		return modint(x);
	}
	friend constexpr modint operator+(const modint&a,const modint&b){return modint(a)+=b;}
	friend constexpr modint operator-(const modint&a,const modint&b){return modint(a)-=b;}
	friend constexpr modint operator*(const modint&a,const modint&b){return modint(a)*=b;}
	friend constexpr modint operator/(const modint&a,const modint&b){return modint(a)/=b;}
	friend constexpr bool operator==(const modint&a,const modint&b){return a.x==b.x;}
	friend constexpr bool operator!=(const modint&a,const modint&b){return a.x!=b.x;}
	friend ostream&operator<<(ostream&os,const modint&a){return os<<a.x;}
	friend istream&operator>>(istream&is,modint&a){long long v;is>>v;a=modint(v);return is;}
};
#line 6 "a.cpp"
using mint=modint<998244353>;
int N,K,X,Y;
mint ans;
main()
{
	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());
	if(A.size()==1);
	else if(N==2)
	{
		for(int a:A)for(int b:A)if(a!=b)
		{
			if(X<=(a^b)&&(a^b)<=Y)ans++;
		}
	}
	else if(N==4)
	{
		vector<mint>all(1024);
		for(int a:A)for(int b:A)if(a!=b)all[a^b]++;
		for(int i=0;i<1024;i++)for(int j=0;j<1024;j++)if(X<=(i^j)&&(i^j)<=Y)ans+=all[i]*all[j];
		all[0]=A.size();
		for(int i=0;i<1024;i++)if(X<=i&&i<=Y)ans-=all[i]*(A.size()-2+!i);
	}
	else
	{
		vector<vector<mint> >now(A.size(),vector<mint>(1024));
		for(int i=0;i<A.size();i++)now[i][A[i]]=1;
		for(int i=1;i<N;i++)
		{
			vector<vector<mint> >nxt(A.size(),vector<mint>(1024));
			for(int i=0;i<A.size();i++)for(int j=0;j<A.size();j++)if(i!=j)
			{
				for(int k=0;k<1024;k++)nxt[j][k^A[j]]+=now[i][k];
			}
			now.swap(nxt);
		}
		for(int i=0;i<A.size();i++)for(int j=X;j<1024&&j<=Y;j++)ans+=now[i][j];
	}
	cout<<ans<<endl;
}
0