-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcp_template.cpp
More file actions
80 lines (72 loc) · 1.66 KB
/
Copy pathcp_template.cpp
File metadata and controls
80 lines (72 loc) · 1.66 KB
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
#include <bits/stdc++.h>
#include <numeric>
#define endl "\n"
#define YES "yes\n"
#define NO "no\n"
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define fn(fc) auto fc = [&]
using namespace std;
using ll = long long;
template <typename... Args> void dbg(Args &&...args) {
#ifdef DEBUG
((cout << args << ' '), ...) << endl;
#endif
}
void cases(int n) {
#ifdef DEBUG
cout << "=============" << n << "============\n";
#endif
}
struct MI {
int x = 0, M = 998244353;
MI() {}
MI(int _x) { x = (_x % M + M) % M; }
MI &operator+=(MI o) {
add(o);
return *this;
}
MI operator+(MI o) { return o += x; }
MI &operator-=(MI o) {
*this += -o.x;
return *this;
}
MI operator-(MI o) { return MI(x) -= o; }
MI &operator*=(MI o) {
mul(o);
return *this;
}
MI operator*(MI o) { return o *= x; }
MI &operator/=(MI o) {
*this *= o.inv();
return *this;
}
MI operator/(MI o) { return MI(x) /= o; }
MI inv() { return pow(M - 2); }
MI pow(int y) {
MI t(1), b(x);
for (; y; y >>= 1, b *= b)
if (y & 1)
t *= b;
return t;
}
friend MI operator+(int lhs, const MI &rhs) { return MI(lhs) + rhs; }
friend MI operator-(int lhs, const MI &rhs) { return MI(lhs) - rhs; }
friend MI operator*(int lhs, const MI &rhs) { return MI(lhs) * rhs; }
friend MI operator/(int lhs, const MI &rhs) { return MI(lhs) / rhs; }
private:
void add(MI y) { x = (x % M + y.x % M) % M; }
void mul(MI y) { x = 1ll * x * y.x % M; }
};
void solve() {}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t = 1;
cin >> t;
for (int i = 1; i <= t; ++i) {
cases(i);
solve();
}
return 0;
}