結果
問題 | No.2275 →↑↓ |
ユーザー |
![]() |
提出日時 | 2023-04-22 18:38:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 5,725 bytes |
コンパイル時間 | 2,100 ms |
コンパイル使用メモリ | 196,136 KB |
最終ジャッジ日時 | 2025-02-12 13:07:32 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 |
ソースコード
#line 1 "1.declarations/template/template.h"#include <bits/stdc++.h>using namespace std;using ll = long long;using ld = long double;using PL = pair<ll, ll>;using P = pair<int, int>;#define overload4(a, b, c, d, name, ...) name#define overload3(a, b, c, name, ...) name#define rep1(n) for(ll i=0;i<n;++i)#define rep2(i, n) for(ll i=0;i<n;++i)#define rep3(i, a, b) for(ll i=a;i<b;++i)#define rep4(i, a, b, c) for(ll i=a;i<b;i+=c)#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)#define rrep1(n) for(ll i=n;i--;)#define rrep2(i, n) for(ll i=n;i--;)#define rrep3(i, a, b) for(ll i=b;i-->(a);)#define rrep4(i, a, b, c) for(ll i=(a)+((b)-(a)-1)/(c)*(c);i>=(a);i-=c)#define CASE ll _t; cin >> _t; rep(tc, 1, _t + 1)#define YESNO(yes, no)void yes(bool b=1){cout<<(b?#yes:#no)<<'\n';}void no(bool b=1){yes(!b);}YESNO(Yes, No)YESNO(YES, NO)template<class T>bool chmax(T &a, const T &b) { if (a >= b) return 0; a = b; return 1; }template<class T, class U>bool chmax(T &a, const U &b) { return chmax(a, (T) b); }template<class T>bool chmin(T &a, const T &b) { if (a <= b) return 0; a = b; return 1; }template<class T, class U>bool chmin(T &a, const U &b) { return chmin(a, (T) b); }ll popcnt(ll a) { return __builtin_popcountll(a); }ll pow(ll x, ll t, ll m) { if (!t) return 1; x %= m; ll r = pow(x, t / 2, m); (r *= r) %= m; if (t % 2)(r *= x) %= m; return r; }template<typename T, typename U>ostream &operator<<(ostream &os, pair<T, U> &p) { os << p.first << " " << p.second; return os; }template<typename T, typename U>istream &operator>>(istream &is, pair<T, U> &p) { is >> p.first >> p.second; return is; }template<typename T>ostream &operator<<(ostream &os, vector<T> &v) { for (auto it = v.begin(); it != v.end();) { os << *it << ((++it) != v.end() ? " " : ""); } return os; }template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &e: v)is >> e; return is; }struct IO { IO() { std::cin.tie(nullptr)->sync_with_stdio(0); fixed(std::cout).precision(20); } } io;namespace Sarievo {const int MOD7 = 1000000007;const int MOD3 = 998244353;const ll INF64 = 0x1fffffffffffffff;const long double pi = 3.14159265358979323;const long double eps = 1e-7;const ll dx[]{+0, +1, +0, -1, +1, +1, -1, -1};const ll dy[]{+1, +0, -1, +0, +1, -1, -1, +1};const string ASCII = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";const string ascii = "abcdefghijklmnopqrstuvwxyz";const string NUM = "0123456789";} // namespace Sarievousing namespace Sarievo;#line 2 "main.cpp"template<int m>struct MInt {private:unsigned int x;public:static MInt raw(int v) {MInt ret;ret.x = v;return ret;}constexpr MInt() : x(0) {}constexpr MInt(int y) {int v = y % m;if (v < 0) v += m;x = (unsigned int) v;}constexpr MInt(long long y) {long long v = y % (long long) m;if (v < 0) v += m;x = (unsigned int) v;}constexpr MInt(unsigned int y) {x = (unsigned int) (y % get_mod());}MInt &operator++() {x++;if (x == get_mod()) x = 0;return *this;}MInt &operator--() {if (x == 0) x = get_mod();x--;return *this;}MInt operator++(int) {MInt ret = *this;++*this;return ret;}MInt operator--(int) {MInt ret = *this;--*this;return ret;}MInt &operator+=(const MInt &p) {if ((x += p.x) >= get_mod()) x -= get_mod();return *this;}MInt &operator-=(const MInt &p) {if ((x -= p.x) >= get_mod()) x += get_mod();return *this;}MInt &operator*=(const MInt &p) {unsigned long long y = x;y *= p.x;x = (unsigned int) (y % get_mod());return *this;}MInt &operator/=(const MInt &p) {return *this *= p.inv();}MInt operator+() const {return *this;}MInt operator-() const {return MInt() - *this;}MInt pow(long long n) const {MInt ret(1), mul = *this;while (n) {if (n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}MInt inv() const {long long a = x, b = m, u = 1, v = 0;while (b) {long long t = a / b;swap(a -= t * b, b);swap(u -= t * v, v);}return MInt(u);}friend MInt operator+(const MInt &l, const MInt &r) {return MInt(l) += r;}friend MInt operator-(const MInt &l, const MInt &r) {return MInt(l) -= r;}friend MInt operator*(const MInt &l, const MInt &r) {return MInt(l) *= r;}friend MInt operator/(const MInt &l, const MInt &r) {return MInt(l) /= r;}friend bool operator==(const MInt &l, const MInt &r) {return l.x == r.x;}friend bool operator!=(const MInt &l, const MInt &r) {return l.x != r.x;}friend istream &operator>>(istream &is, MInt &a) {long long t;is >> t;a = MInt(t);return (is);}friend ostream &operator<<(ostream &os, const MInt &p) {return os << p.val();}static constexpr int get_mod() {return m;}[[nodiscard]] int val() const {return (int) x;}};void solve() {using mint = MInt<MOD3>;ll n;cin >> n;vector<ll> a(n);cin >> a;mint ans = 1;rep(n - 1) {ans *= min(a[i], a[i + 1]);}cout << ans << '\n';}signed main() {solve();}