結果

問題 No.2275 →↑↓
ユーザー Astral__
提出日時 2024-08-18 11:20:37
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 4,252 bytes
コンパイル時間 5,814 ms
コンパイル使用メモリ 309,652 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-08-18 11:20:46
合計ジャッジ時間 7,781 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
std::ostream &operator<<(std::ostream &os, const atcoder::modint998244353 &v) {
os << v.val();
return os;
}
std::istream &operator>>(std::istream &is, atcoder::modint998244353 &v) {
long long x;
is >> x;
v = x;
return is;
}
std::ostream &operator<<(std::ostream &os, const atcoder::modint1000000007 &v) {
os << v.val();
return os;
}
std::istream &operator>>(std::istream &is, atcoder::modint1000000007 &v) {
long long x;
is >> x;
v = x;
return is;
}
#endif
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
#define rrep(i, s, t) for (ll i = (ll)(t) - 1; i >= (ll)(s); i--)
#define all(x) begin(x), end(x)
#define TT template <typename T>
TT using vec = vector<T>;
TT using vvec = vec<vec<T>>;
TT using vvvec = vec<vvec<T>>;
TT using minheap = priority_queue<T, vector<T>, greater<T>>;
TT using maxheap = priority_queue<T>;
template <class T1, class T2> bool chmin(T1 &x, T2 y) {
return x > y ? (x = y, true) : false;
}
template <class T1, class T2> bool chmax(T1 &x, T2 y) {
return x < y ? (x = y, true) : false;
}
struct io_setup {
io_setup() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout << fixed << setprecision(15);
}
} io_setup;
template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
os << p.first << " " << p.second;
return os;
}
TT ostream &operator<<(ostream &os, const vec<T> &v) {
for (size_t i = 0; i < v.size(); i++) {
os << v[i] << (i + 1 != v.size() ? " " : "");
}
return os;
}
template <typename T, ll n>
ostream &operator<<(ostream &os, const array<T, n> &v) {
for (size_t i = 0; i < n; i++) {
os << v[i] << (i + 1 != n ? " " : "");
}
return os;
}
template <typename T> std::ostream &operator<<(ostream &os, const vvec<T> &v) {
for (size_t i = 0; i < v.size(); i++) {
os << v[i] << (i + 1 != v.size() ? "\n" : "");
}
return os;
}
TT istream &operator>>(istream &is, vec<T> &v) {
for (size_t i = 0; i < v.size(); i++) {
is >> v[i];
}
return is;
}
#if __has_include(<debug/debug.hpp>)
#include <debug/debug.hpp>
#else
#define dbg(...) true
#define DBG(...) true
#endif
// mod : template<int mod> mod
template <uint32_t mod> struct modint {
using mm = modint;
uint32_t x;
modint() : x(0) {}
TT modint(T a = 0) : x((ll(a) % mod + mod)) {
if (x >= mod) x -= mod;
}
friend mm operator+(mm a, mm b) {
a.x += b.x;
if (a.x >= mod) a.x -= mod;
return a;
}
friend mm operator-(mm a, mm b) {
a.x -= b.x;
if (a.x >= mod) a.x += mod;
return a;
}
//+-
friend mm operator*(mm a, mm b) { return (uint64_t)(a.x) * b.x; }
friend mm operator/(mm a, mm b) { return a * b.inv(); }
friend mm &operator+=(mm &a, mm b) { return a = a + b; }
friend mm &operator-=(mm &a, mm b) { return a = a - b; }
friend mm &operator*=(mm &a, mm b) { return a = a * b; }
friend mm &operator/=(mm &a, mm b) { return a = a * b.inv(); }
mm inv() const { return pow(mod - 2); }
mm pow(ll y) const {
mm res = 1;
mm v = *this;
while (y) {
if (y & 1) res *= v;
v *= v;
y /= 2;
}
return res;
}
friend istream &operator>>(istream &is, mm &a) {
ll t;
cin >> t;
a = mm(t);
return is;
}
friend ostream &operator<<(ostream &os, mm a) { return os << a.x; }
bool operator==(mm a) { return x == a.x; }
bool operator!=(mm a) { return x != a.x; }
bool operator<(const mm &a) const { return x < a.x; }
};
using modint998244353 = modint<998244353>;
using modint1000000007 = modint<1'000'000'007>;
/*
@brief modint
*/
using mint = modint998244353;
int main() {
ll n;
cin >> n;
vec<ll> A(n);
rep(i, 0, n) cin >> A[i];
mint res = 1;
rep(i, 0, n - 1) res *= min(A[i], A[i + 1]);
cout << res << endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0