結果
| 問題 |
No.2679 MODice
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-20 21:25:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 2,000 ms |
| コード長 | 2,510 bytes |
| コンパイル時間 | 2,301 ms |
| コンパイル使用メモリ | 211,084 KB |
| 最終ジャッジ日時 | 2025-02-20 08:42:32 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int 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<long double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}
template <int mod>
struct static_modint {
using mint = static_modint;
int x;
static_modint() : x(0) {}
static_modint(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
mint& operator+=(const mint& rhs) {
if ((x += rhs.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint& rhs) {
if ((x += mod - rhs.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint& rhs) {
x = (int) (1LL * x * rhs.x % mod);
return *this;
}
mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }
mint pow(long long n) const {
mint _x = *this, r = 1;
while (n) {
if (n & 1) r *= _x;
_x *= _x;
n >>= 1;
}
return r;
}
mint inv() const { return pow(mod - 2); }
mint operator+() const { return *this; }
mint operator-() const { return mint() - *this; }
friend mint operator+(const mint& lhs, const mint& rhs) {
return mint(lhs) += rhs;
}
friend mint operator-(const mint& lhs, const mint& rhs) {
return mint(lhs) -= rhs;
}
friend mint operator*(const mint& lhs, const mint& rhs) {
return mint(lhs) *= rhs;
}
friend mint operator/(const mint& lhs, const mint& rhs) {
return mint(lhs) /= rhs;
}
friend bool operator==(const mint& lhs, const mint& rhs) {
return lhs.x == rhs.x;
}
friend bool operator!=(const mint& lhs, const mint& rhs) {
return lhs.x != rhs.x;
}
friend ostream &operator<<(ostream &os, const mint &p) {
return os << p.x;
}
friend istream &operator>>(istream &is, mint &a) {
int64_t t; is >> t;
a = static_modint<mod>(t);
return (is);
}
};
const unsigned int mod = 998244353;
using modint = static_modint<mod>;
modint mod_pow(ll n, ll x) { return modint(n).pow(x); }
modint mod_pow(modint n, ll x) { return n.pow(x); }
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << 166374059 << endl;
}