1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109 | #include<bits/stdc++.h>
#define int long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define power(x) ((x)*(x))
#define eb emplace_back
#define pb pop_back
#define mp make_pair
#define fi first
#define se second
#define TT template<typename T>
#define TA template<typename T,typename ...Args>
#define dbg(x) cerr<<"In Line "<< __LINE__<<" the "<<#x<<" = "<<x<<'\n';
using namespace std;
using pii=pair<int,int>;
using pdi=pair<double,int>;
using piii=pair<pair<int,int>,int>;
bool Mbe;
namespace IO
{
inline int read()
{
int s=0,w=0; char c=getchar();
while(!isdigit(c)) w|=c=='-',c=getchar();
while(isdigit(c)) s=(s*10)+(c^48),c=getchar();
return s*(w?-1:1);
}
TT inline void read(T &s)
{
s=0; int w=0; char c=getchar();
while(!isdigit(c)) w|=c=='-',c=getchar();
while(isdigit(c)) s=(s*10)+(c^48),c=getchar();
s*=w?-1:1;
}
TA inline void read(T &x,Args &...args) {read(x),read(args...);}
TT inline void write(T x,char ch=' ')
{
if(x<0) x=-x,putchar('-');
static char stk[30]; int top=0;
do stk[top++]=x%10+'0',x/=10; while(x);
while(top) putchar(stk[--top]);
if(ch!='~') putchar(ch);
}
}
using namespace IO;
namespace MTool
{
static const int Mod=998244353;
TT inline void Swp(T &a,T &b) {T t=a;a=b;b=t;}
TT inline void cmax(T &a,T b) {a=max(a,b);}
TA inline void cmax(T &a,T b,Args ...args) {a=max({a,b,args...});}
TT inline void cmin(T &a,T b) {a=min(a,b);}
TA inline void cmin(T &a,T b,Args ...args) {a=min({a,b,args...});}
TT inline T Cadd(T a,T b) {return a+b>=Mod?a+b-Mod:a+b;}
TT inline T Cdel(T a,T b) {return a-b<0?a-b+Mod:a-b;}
TT inline T Cmul(T a,T b) {return a*b%Mod;}
TT inline T Cmod(T a) {return (a%Mod+Mod)%Mod;}
TT inline void Madd(T &a,T b) {a=a+b>=Mod?a+b-Mod:a+b;}
TT inline void Mdel(T &a,T b) {a=a-b<0?a-b+Mod:a-b;}
TT inline void Mmul(T &a,T b) {a=a*b%Mod;}
TT inline void Mmod(T &a) {a=(a%Mod+Mod)%Mod;}
TA inline T Cadd(T a,T b,Args ...args) {return Cadd(Cadd(a,b),args...);}
TA inline T Cdel(T a,T b,Args ...args) {return Cdel(Cdel(a,b),args...);}
TA inline T Cmul(T a,T b,Args ...args) {return Cmul(Cmul(a,b),args...);}
TA inline void Madd(T &a,T b,Args ...args) {Madd(a,Cadd(b,args...));}
TA inline void Mdel(T &a,T b,Args ...args) {Mdel(a,Cadd(b,args...));}
TA inline void Mmul(T &a,T b,Args ...args) {Mmul(a,Cmul(b,args...));}
TT inline T qpow(T a,T b) {int res=1; while(b) {if(b&1) Mmul(res,a); Mmul(a,a); b>>=1;} return res;}
TT inline T qmul(T a,T b) {int res=0; while(b) {if(b&1) Madd(res,a); Madd(a,a); b>>=1;} return res;}
TT inline T spow(T a,T b) {int res=1; while(b) {if(b&1) res=qmul(res,a); a=qmul(a,a); b>>=1;} return res;}
TT inline void exgcd(T A,T B,T &X,T &Y) {if(!B) return X=1,Y=0,void(); exgcd(B,A%B,Y,X),Y-=X*(A/B);}
TT inline T Ginv(T x) {T A=0,B=0; exgcd(x,Mod,A,B); return Cmod(A);}
}
using namespace MTool;
inline void file()
{
freopen(".in","r",stdin);
freopen(".out","w",stdout);
}
namespace LgxTpre
{
constexpr int MAX=100010;
constexpr int inf=2147483647;
constexpr int INF=4557430888798830399;
inline void mian()
{
}
}
bool Med;
signed main()
{
// file();
int Tbe=clock();
LgxTpre::mian();
int Ted=clock();
fprintf(stderr,"\nMemory: %.3lf MB",abs(&Mbe-&Med)/1024.0/1024.0);
fprintf(stderr,"\nTime: %.3lf ms",1e3*(Ted-Tbe)/CLOCKS_PER_SEC);
return (0-0);
}
|