QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#839291 | #1089. Biological Software Utilities | highkj | AC ✓ | 0ms | 11564kb | C++11 | 1.3kb | 2025-01-01 16:35:34 | 2025-01-01 16:35:35 |
Judging History
answer
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define rep(i,x,y) for(register int i=x;i<=y;i++)
#define rep1(i,x,y) for(register int i=x;i>=y;--i)
#define int long long
#define fire signed
#define il inline
template<class T> il void print(T x) {
if(x<0) printf("-"),x=-x;
if (x > 9) print(x / 10);
putchar(x % 10 + '0');
}
template<class T> il void in(T &x) {
x = 0; char ch = getchar();
int f = 1;
while (ch < '0' || ch > '9') {if(ch=='-') f = -1; ch = getchar(); }
while (ch >= '0' && ch <= '9') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar(); }
x *= f;
}
int T=1;
int n;
const int N=1e6+10,mod=998244353;
int jc[N];
int qmi(int x,int y) {
int res=1;
if(y<0) return 1;
while(y) {
if(y&1) res=res*x%mod;
x=x*x%mod;
y>>=1;
}return res;
}
void solve() {
in(n);
if(n&1) {
cout<<0<<endl;
return;
}
jc[0]=1;
rep(i,1,n) jc[i]=jc[i-1]*i%mod;
int res=jc[n];
res=res*qmi(jc[n/2],mod-2)%mod;
res=res*qmi(qmi(2,n/2),mod-2)%mod;
res=res*qmi(n/2,(n/2)-2)%mod;
res=res*qmi(4,(n/2)-1)%mod;
printf("%lld\n",res);
}
fire main() {
while(T--) {
solve();
}
return false;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3636kb
input:
1
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
2
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
3
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3948kb
input:
4
output:
12
result:
ok 1 number(s): "12"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
7788
output:
178152092
result:
ok 1 number(s): "178152092"
Test #6:
score: 0
Accepted
time: 0ms
memory: 11560kb
input:
1000000
output:
178454094
result:
ok 1 number(s): "178454094"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
12346
output:
751958800
result:
ok 1 number(s): "751958800"
Test #8:
score: 0
Accepted
time: 0ms
memory: 11564kb
input:
999996
output:
690785929
result:
ok 1 number(s): "690785929"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
6
output:
720
result:
ok 1 number(s): "720"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
10
output:
30240000
result:
ok 1 number(s): "30240000"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
99
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
100
output:
934178078
result:
ok 1 number(s): "934178078"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
20
output:
245111072
result:
ok 1 number(s): "245111072"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
38745
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
3848
output:
928659530
result:
ok 1 number(s): "928659530"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
347835
output:
0
result:
ok 1 number(s): "0"
Test #17:
score: 0
Accepted
time: 0ms
memory: 7340kb
input:
234234
output:
745247398
result:
ok 1 number(s): "745247398"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
12
output:
818069491
result:
ok 1 number(s): "818069491"
Test #19:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
98
output:
648803799
result:
ok 1 number(s): "648803799"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
124
output:
159487965
result:
ok 1 number(s): "159487965"
Test #21:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
1024
output:
318674437
result:
ok 1 number(s): "318674437"
Test #22:
score: 0
Accepted
time: 0ms
memory: 8656kb
input:
524288
output:
495260023
result:
ok 1 number(s): "495260023"
Test #23:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
524289
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
999999
output:
0
result:
ok 1 number(s): "0"
Test #25:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
999997
output:
0
result:
ok 1 number(s): "0"