Submission #33626826


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
const long long N=4e5+5,mod=998244353;
long long n;
long long mul[N],inv[N];
long long ksm(long long f,long long x){
	long long tot=1;
	while(x){
		if(x & 1ll) tot=1ll*tot*f%mod;
		f=1ll*f*f%mod;
		x>>=1ll;
	}
	return tot;
}
 
void init(long long lim){
	mul[0]=inv[0]=1;
	for(long long i=1;i<=lim;i++) mul[i]=1ll*mul[i-1]*i%mod;
	inv[lim]=ksm(mul[lim],mod-2);
	for(long long i=lim-1;i>=1;i--) inv[i]=1ll*inv[i+1]*(i+1)%mod;
}
long long C(long long m,long long n){
	if(m<0 || n<0 || m<n) return 0;
	return 1ll*mul[m]*inv[n]%mod*inv[m-n]%mod;
}


long long dp[N];
int main(){
	init(N-5);
	cin>>n;
	cout<<C(2*n,n+1)*ksm(n,mod-2)%mod*mul[n]%mod*ksm(2,n)%mod;
}

Submission Info

Submission Time
Task C - Split and Maximize
User PineAppleBlue17
Language C++ (GCC 9.2.1)
Score 600
Code Size 733 Byte
Status AC
Exec Time 17 ms
Memory 9852 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 2
AC × 25
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 14 ms 9784 KiB
00_sample_02.txt AC 11 ms 9744 KiB
01_small_01.txt AC 17 ms 9616 KiB
01_small_02.txt AC 11 ms 9844 KiB
01_small_03.txt AC 12 ms 9780 KiB
01_small_04.txt AC 13 ms 9784 KiB
01_small_05.txt AC 11 ms 9624 KiB
02_random_01.txt AC 10 ms 9784 KiB
02_random_02.txt AC 13 ms 9668 KiB
02_random_03.txt AC 12 ms 9680 KiB
02_random_04.txt AC 11 ms 9676 KiB
02_random_05.txt AC 13 ms 9752 KiB
02_random_06.txt AC 10 ms 9736 KiB
02_random_07.txt AC 11 ms 9776 KiB
02_random_08.txt AC 13 ms 9816 KiB
02_random_09.txt AC 11 ms 9808 KiB
02_random_10.txt AC 12 ms 9736 KiB
02_random_11.txt AC 11 ms 9808 KiB
02_random_12.txt AC 10 ms 9752 KiB
02_random_13.txt AC 13 ms 9624 KiB
02_random_14.txt AC 11 ms 9820 KiB
02_random_15.txt AC 12 ms 9784 KiB
02_random_16.txt AC 13 ms 9852 KiB
02_random_17.txt AC 9 ms 9844 KiB
02_random_18.txt AC 10 ms 9664 KiB