結果
問題 | No.2275 →↑↓ |
ユーザー | Sarievo |
提出日時 | 2023-04-21 21:31:25 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 7,007 bytes |
コンパイル時間 | 3,576 ms |
コンパイル使用メモリ | 225,036 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-06 14:59:05 |
合計ジャッジ時間 | 5,199 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,820 KB |
testcase_01 | AC | 2 ms
6,816 KB |
testcase_02 | AC | 2 ms
6,816 KB |
testcase_03 | AC | 2 ms
6,820 KB |
testcase_04 | AC | 2 ms
6,816 KB |
testcase_05 | AC | 2 ms
6,820 KB |
testcase_06 | AC | 66 ms
6,816 KB |
testcase_07 | AC | 50 ms
6,820 KB |
testcase_08 | AC | 81 ms
6,816 KB |
testcase_09 | AC | 82 ms
6,820 KB |
testcase_10 | AC | 82 ms
6,820 KB |
testcase_11 | AC | 82 ms
6,820 KB |
testcase_12 | AC | 80 ms
6,820 KB |
testcase_13 | AC | 81 ms
6,820 KB |
testcase_14 | AC | 82 ms
6,820 KB |
ソースコード
#line 1 "template/f.h" #include <bits/stdc++.h> using namespace std; /* --- PBDS, ref: https://codeforces.com/blog/entry/11080 --- */ #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<class T> using IndexSet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<class T> using IndexMultiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; /* --- CUSTOM HASH, ref: https://codeforces.com/blog/entry/62393 --- */ struct MyHash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM); } }; template<class T> using us = unordered_set<T, MyHash>; template<class T, class U> using um = unordered_map<T, U, MyHash>; using ll = long long; using ld = long double; using PL = pair<ll, ll>; using P = pair<int, int>; template<class T> using minheap = priority_queue<T, vector<T>, greater<T>>; template<class T> using maxheap = priority_queue<T>; #define overload5(a, b, c, d, e, name, ...) name #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 rrep(...) overload4(__VA_ARGS__,rrep4,rrep3,rrep2,rrep1)(__VA_ARGS__) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define sm(...) accumulate(all(__VA_ARGS__),0LL) #define CASE ll _t; cin >> _t; rep(tc, 1, _t + 1) #define YESNO(yes, no)void yes(bool i=1){cout<<(i?#yes:#no)<<'\n';}void no(){cout<<(#no)<<'\n';} YESNO(Yes, No) YESNO(YES, NO) ll fast_exp(ll x, ll t, ll mod) { if (!t)return 1; x %= mod; ll r = fast_exp(x, t / 2, mod); (r *= r) %= mod; if (t % 2)(r *= x) %= mod; return r; } ll popcnt(ll a) { return __builtin_popcountll(a); } template<class T> void unique(T &a) { sort(all(a)); a.erase(unique(all(a)), end(a)); } template<class T> auto press(const T &a) { vector<pair<decay_t<decltype(a[0])>, ll>> ans; for (auto &&x: a) { if (ans.empty() || ans.back().first != x) ans.emplace_back(x, 1); else ans.back().second++; } return ans; } 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); } 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<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 FastIO { FastIO() { cin.tie(nullptr)->sync_with_stdio(0); fixed(cout).precision(20); } }; namespace Sarievo { const int MOD7 = 1000000007; const int MOD3 = 998244353; const ll dx[]{+0, +1, +0, -1, +1, +1, -1, -1}; const ll dy[]{+1, +0, -1, +0, +1, -1, -1, +1}; const ll INF64 = 0x1fffffffffffffff; } // namespace Sarievo using namespace Sarievo; #line 1 "misc/modint.h" template<int m> struct modint { private: unsigned int x; static constexpr unsigned int umod() { return m; } public: static modint raw(int v) { modint ret; ret.x = v; return ret; } constexpr modint() : x(0) {} constexpr modint(int y) { int v = y % m; if (v < 0) v += m; x = (unsigned int) v; } constexpr modint(long long y) { long long v = y % (long long) m; if (v < 0) v += m; x = (unsigned int) v; } constexpr modint(unsigned int y) { x = (unsigned int) (y % umod()); } modint &operator++() { x++; if (x == umod()) x = 0; return *this; } modint &operator--() { if (x == 0) x = umod(); x--; return *this; } modint operator++(int) { modint ret = *this; ++*this; return ret; } modint operator--(int) { modint ret = *this; --*this; return ret; } modint &operator+=(const modint &p) { if ((x += p.x) >= umod()) x -= umod(); return *this; } modint &operator-=(const modint &p) { if ((x -= p.x) >= umod()) x += umod(); return *this; } modint &operator*=(const modint &p) { unsigned long long y = x; y *= p.x; x = (unsigned int) (y % umod()); return *this; } modint &operator/=(const modint &p) { return *this *= p.inv(); } modint operator+() const { return *this; } modint operator-() const { return modint() - *this; } modint pow(long long n) const { modint ret(1), mul = *this; while (n) { if (n & 1) ret *= mul; mul *= mul; n >>= 1; } return ret; } modint 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 modint(u); } friend modint operator+(const modint &l, const modint &r) { return modint(l) += r; } friend modint operator-(const modint &l, const modint &r) { return modint(l) -= r; } friend modint operator*(const modint &l, const modint &r) { return modint(l) *= r; } friend modint operator/(const modint &l, const modint &r) { return modint(l) /= r; } friend bool operator==(const modint &l, const modint &r) { return l.x == r.x; } friend bool operator!=(const modint &l, const modint &r) { return l.x != r.x; } friend ostream &operator<<(ostream &os, const modint &p) { return os << p.val(); } friend istream &operator>>(istream &is, modint &a) { long long t; is >> t; a = modint(t); return (is); } static constexpr int get_mod() { return m; } [[nodiscard]] int val() const { return (int) x; } }; #line 3 "main.cpp" using mint = modint<MOD3>; signed main() { 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'; }