QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#189898 | #1089. Biological Software Utilities | KKT89 | AC ✓ | 12ms | 19508kb | C++17 | 2.0kb | 2023-09-28 01:22:44 | 2023-09-28 01:22:44 |
Judging History
answer
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <sstream>
#include <utility>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <array>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
return (ull)rng() % B;
}
inline double time() {
return static_cast<double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}
constexpr ll mod = 998244353;
ll mod_pow(ll a,ll b){
a%=mod;
if(b==0)return 1;
if(b==1)return a;
ll res=mod_pow(a,b/2)%mod;
res*=res; res%=mod;
if(b%2)res*=a;
return res%mod;
}
struct perm{
private:
int sz;
vector<ll> p,invp;
public:
perm(int n){
sz=n+1;
p.resize(sz),invp.resize(sz);
p[0]=1;
for(int i=1;i<=sz-1;i++){
p[i]=p[i-1]*i%mod;
}
invp[sz-1]=mod_pow(p[sz-1],mod-2);
for(int i=sz-2;i>=0;i--){
invp[i]=invp[i+1]*(i+1)%mod;
}
}
ll comb(ll x,ll y){
if(x<y||y<0)return 0;
return (p[x]*invp[x-y]%mod)*invp[y]%mod;
}
};
perm p(1<<20);
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n; cin >> n;
if(n%2 == 1){
cout << 0 << endl;
return 0;
}
ll res = 1;
for(int i=n-1;i>=1;i-=2){
res *= (ll)i;
res %= mod;
}
n /= 2;
if(n == 1){
cout << res << endl;
return 0;
}
res *= mod_pow(n, n-2);
res %= mod;
res *= mod_pow(2, 2*n-2);
res %= mod;
cout << res << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 8ms
memory: 19508kb
input:
1
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 8ms
memory: 19388kb
input:
2
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 8ms
memory: 19492kb
input:
3
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 6ms
memory: 19488kb
input:
4
output:
12
result:
ok 1 number(s): "12"
Test #5:
score: 0
Accepted
time: 8ms
memory: 19456kb
input:
7788
output:
178152092
result:
ok 1 number(s): "178152092"
Test #6:
score: 0
Accepted
time: 9ms
memory: 19428kb
input:
1000000
output:
178454094
result:
ok 1 number(s): "178454094"
Test #7:
score: 0
Accepted
time: 8ms
memory: 19432kb
input:
12346
output:
751958800
result:
ok 1 number(s): "751958800"
Test #8:
score: 0
Accepted
time: 11ms
memory: 19492kb
input:
999996
output:
690785929
result:
ok 1 number(s): "690785929"
Test #9:
score: 0
Accepted
time: 9ms
memory: 19424kb
input:
6
output:
720
result:
ok 1 number(s): "720"
Test #10:
score: 0
Accepted
time: 8ms
memory: 19400kb
input:
10
output:
30240000
result:
ok 1 number(s): "30240000"
Test #11:
score: 0
Accepted
time: 6ms
memory: 19392kb
input:
99
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 8ms
memory: 19388kb
input:
100
output:
934178078
result:
ok 1 number(s): "934178078"
Test #13:
score: 0
Accepted
time: 6ms
memory: 19504kb
input:
20
output:
245111072
result:
ok 1 number(s): "245111072"
Test #14:
score: 0
Accepted
time: 8ms
memory: 19400kb
input:
38745
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 0
Accepted
time: 6ms
memory: 19400kb
input:
3848
output:
928659530
result:
ok 1 number(s): "928659530"
Test #16:
score: 0
Accepted
time: 12ms
memory: 19420kb
input:
347835
output:
0
result:
ok 1 number(s): "0"
Test #17:
score: 0
Accepted
time: 6ms
memory: 19456kb
input:
234234
output:
745247398
result:
ok 1 number(s): "745247398"
Test #18:
score: 0
Accepted
time: 8ms
memory: 19440kb
input:
12
output:
818069491
result:
ok 1 number(s): "818069491"
Test #19:
score: 0
Accepted
time: 8ms
memory: 19388kb
input:
98
output:
648803799
result:
ok 1 number(s): "648803799"
Test #20:
score: 0
Accepted
time: 8ms
memory: 19436kb
input:
124
output:
159487965
result:
ok 1 number(s): "159487965"
Test #21:
score: 0
Accepted
time: 12ms
memory: 19388kb
input:
1024
output:
318674437
result:
ok 1 number(s): "318674437"
Test #22:
score: 0
Accepted
time: 9ms
memory: 19504kb
input:
524288
output:
495260023
result:
ok 1 number(s): "495260023"
Test #23:
score: 0
Accepted
time: 12ms
memory: 19412kb
input:
524289
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 8ms
memory: 19424kb
input:
999999
output:
0
result:
ok 1 number(s): "0"
Test #25:
score: 0
Accepted
time: 6ms
memory: 19440kb
input:
999997
output:
0
result:
ok 1 number(s): "0"