Submission #33346584


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod=998244353;
const int N=3e5+5;
LL n,k,ans;
LL fac[N],inv[N];
LL prod[N]; //从K 往前 i 个数的连乘  
LL qwqmi(LL x,LL b)
{
	LL res=1;
	while(b)
	{
		if(b&1) res=res*x%mod;
		x=x*x%mod;
		b>>=1;
	}
	return res%mod;
}
void preprocess()
{
	fac[0]=inv[0]=1;
	for(int i=1;i<N;i++)
		fac[i]=fac[i-1]*i%mod;
	inv[N-1]=qwqmi(fac[N-1],mod-2);
	for(int i=N-2;i>=1;i--)
		inv[i]=inv[i+1]*(i+1)%mod;
}
int main()
{
	preprocess();
	scanf("%lld%lld",&n,&k);
	prod[0]=1;
	for(LL i=1;i<N;i++)
		prod[i]=prod[i-1]*((k-i+2)%mod)%mod;
	for(int i=0;i<=min(n,k);i++)
	{
		LL twomi=qwqmi(2,i);
		LL w1=fac[n]*inv[i]%mod*inv[n-i]%mod;
		LL w2=inv[i+1]*prod[i+1]%mod;
		LL res=twomi*w1%mod*w2%mod;
		ans+=res;
		ans%=mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Submission Info

Submission Time
Task D - AND OR Equation
User Schucking_Sattin
Language C++ (GCC 9.2.1)
Score 700
Code Size 867 Byte
Status AC
Exec Time 44 ms
Memory 10856 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:32:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   32 |  scanf("%lld%lld",&n,&k);
      |  ~~~~~^~~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 3
AC × 54
Set Name Test Cases
Sample 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt
All 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt, 02_small_01.txt, 02_small_02.txt, 02_small_03.txt, 02_small_04.txt, 02_small_05.txt, 02_small_06.txt, 02_small_07.txt, 02_small_08.txt, 02_small_09.txt, 02_small_10.txt, 02_small_11.txt, 02_small_12.txt, 02_small_13.txt, 02_small_14.txt, 02_small_15.txt, 02_small_16.txt, 03_rand_01.txt, 03_rand_02.txt, 03_rand_03.txt, 03_rand_04.txt, 03_rand_05.txt, 03_rand_06.txt, 03_rand_07.txt, 03_rand_08.txt, 03_rand_09.txt, 03_rand_10.txt, 04_maxrand_01.txt, 04_maxrand_02.txt, 04_maxrand_03.txt, 04_maxrand_04.txt, 04_maxrand_05.txt, 04_maxrand_06.txt, 04_maxrand_07.txt, 04_maxrand_08.txt, 04_maxrand_09.txt, 04_maxrand_10.txt, 05_small_K_01.txt, 05_small_K_02.txt, 05_small_K_03.txt, 05_small_K_04.txt, 05_small_K_05.txt, 05_small_K_06.txt, 05_small_K_07.txt, 05_small_K_08.txt, 05_small_K_09.txt, 05_small_K_10.txt, 06_near_998244353x_01.txt, 06_near_998244353x_02.txt, 06_near_998244353x_03.txt, 06_near_998244353x_04.txt, 06_near_998244353x_05.txt
Case Name Status Exec Time Memory
01_sample_01.txt AC 15 ms 10636 KiB
01_sample_02.txt AC 13 ms 10852 KiB
01_sample_03.txt AC 14 ms 10796 KiB
02_small_01.txt AC 14 ms 10852 KiB
02_small_02.txt AC 15 ms 10740 KiB
02_small_03.txt AC 13 ms 10744 KiB
02_small_04.txt AC 13 ms 10604 KiB
02_small_05.txt AC 13 ms 10852 KiB
02_small_06.txt AC 17 ms 10796 KiB
02_small_07.txt AC 12 ms 10740 KiB
02_small_08.txt AC 16 ms 10732 KiB
02_small_09.txt AC 13 ms 10752 KiB
02_small_10.txt AC 12 ms 10748 KiB
02_small_11.txt AC 12 ms 10796 KiB
02_small_12.txt AC 12 ms 10748 KiB
02_small_13.txt AC 15 ms 10664 KiB
02_small_14.txt AC 13 ms 10796 KiB
02_small_15.txt AC 13 ms 10660 KiB
02_small_16.txt AC 13 ms 10740 KiB
03_rand_01.txt AC 36 ms 10852 KiB
03_rand_02.txt AC 35 ms 10744 KiB
03_rand_03.txt AC 20 ms 10712 KiB
03_rand_04.txt AC 21 ms 10796 KiB
03_rand_05.txt AC 23 ms 10748 KiB
03_rand_06.txt AC 19 ms 10660 KiB
03_rand_07.txt AC 18 ms 10856 KiB
03_rand_08.txt AC 28 ms 10736 KiB
03_rand_09.txt AC 28 ms 10632 KiB
03_rand_10.txt AC 39 ms 10856 KiB
04_maxrand_01.txt AC 37 ms 10604 KiB
04_maxrand_02.txt AC 41 ms 10852 KiB
04_maxrand_03.txt AC 39 ms 10712 KiB
04_maxrand_04.txt AC 39 ms 10608 KiB
04_maxrand_05.txt AC 39 ms 10796 KiB
04_maxrand_06.txt AC 44 ms 10744 KiB
04_maxrand_07.txt AC 38 ms 10784 KiB
04_maxrand_08.txt AC 38 ms 10748 KiB
04_maxrand_09.txt AC 37 ms 10740 KiB
04_maxrand_10.txt AC 34 ms 10852 KiB
05_small_K_01.txt AC 12 ms 10604 KiB
05_small_K_02.txt AC 13 ms 10744 KiB
05_small_K_03.txt AC 11 ms 10636 KiB
05_small_K_04.txt AC 12 ms 10852 KiB
05_small_K_05.txt AC 13 ms 10744 KiB
05_small_K_06.txt AC 13 ms 10748 KiB
05_small_K_07.txt AC 12 ms 10748 KiB
05_small_K_08.txt AC 13 ms 10632 KiB
05_small_K_09.txt AC 13 ms 10784 KiB
05_small_K_10.txt AC 11 ms 10744 KiB
06_near_998244353x_01.txt AC 39 ms 10656 KiB
06_near_998244353x_02.txt AC 15 ms 10604 KiB
06_near_998244353x_03.txt AC 19 ms 10744 KiB
06_near_998244353x_04.txt AC 35 ms 10748 KiB
06_near_998244353x_05.txt AC 24 ms 10708 KiB