結果
問題 |
No.8119 間に合いませんでした><;
|
ユーザー |
|
提出日時 | 2025-06-19 08:23:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 11,926 bytes |
コンパイル時間 | 2,344 ms |
コンパイル使用メモリ | 195,388 KB |
実行使用メモリ | 14,496 KB |
最終ジャッジ日時 | 2025-06-19 08:23:13 |
合計ジャッジ時間 | 4,774 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 23 TLE * 2 -- * 4 |
ソースコード
#include <bits/stdc++.h> #include <cstdarg> #include <initializer_list> // ―――――――――――――――――――――――――――――――― // abbreviation // ―――――――――――――――――――――――――――――――― using namespace std; using ll = long long; template <typename T> using V = vector<T>; template <typename T> using VV = vector<vector<T>>; using vi = vector<int>; using vl = vector<ll>; using vd = V<double>; using vs = V<string>; using vvi = vector<vector<int>>; using vvl = vector<vector<ll>>; using vvc = vector<vector<char>>; using si = set<int>; using mi = multiset<int>; template <typename T> using minpq = priority_queue<T, vector<T>, greater<T>>; // ―――――――――――――――――――――――――――――――― // P // ―――――――――――――――――――――――――――――――― template <typename T, typename U> struct P : pair<T, U> { template <typename... Args> P(Args... args) : pair<T, U>(args...) {} using pair<T, U>::first; using pair<T, U>::second; P& operator+=(const P& r) { first += r.first; second += r.second; return *this; } P& operator-=(const P& r) { first -= r.first; second -= r.second; return *this; } P& operator*=(const P& r) { first *= r.first; second *= r.second; return *this; } template <typename S> P& operator*=(const S& r) { first *= r, second *= r; return *this; } P operator+(const P& r) const { return P(*this) += r; } P operator-(const P& r) const { return P(*this) -= r; } P operator*(const P& r) const { return P(*this) *= r; } template <typename S> P operator*(const S& r) const { return P(*this) *= r; } P operator-() const { return P{-first, -second}; } }; using pl = P<ll, ll>; using pi = P<int, int>; using vp = V<pl>; // ―――――――――――――――――――――――――――――――― // preprocessor // ―――――――――――――――――――――――――――――――― #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define call(v) (v).cbegin(), (v).cend() #define each(i, v) for (auto i : (v)) #define each2(x, y, v) for (auto [x, y] : (v)) #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--) #define reg(i, l, r) for (ll i = (ll)(l); i < (ll)(r); i++) #define regr(i, l, r) for (ll i = (ll)(r) - 1; i >= (ll)(l); i--) #define REP(i, n) for (ll i = 0; i <= (ll)(n); i++) #define REPR(i, n) for (ll i = (ll)(n); i >= 0; i--) #define REG(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); i++) #define REGR(i, l, r) for (ll i = (ll)(r); i >= (ll)(l); i--) #define Yes cout << "Yes" << el #define No cout << "No" << el #define YES cout << "YES" << el #define NO cout << "NO" << el #define eps (1e-10) #define Equals(a, b) (fabs((a) - (b)) < eps) #define MAX(x) *max_element(all(x)) #define MIN(x) *min_element(all(x)) #define BIT(n) (1LL << (n)) #define pb push_back // #define fi first // #define se second // ―――――――――――――――――――――――――――――――― // constexpr // ―――――――――――――――――――――――――――――――― constexpr int INF = 0x3f3f3f3f; constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr double EPS = 1e-8; constexpr int MOD = 998244353; // constexpr int MOD = 1000000007; constexpr string_view ascii_lowercase = "abcdefghijklmnopqrstuvwxyz"; constexpr string_view ascii_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; constexpr char el = '\n'; constexpr char spa = ' '; // ―――――――――――――――――――――――――――――――― // yn, YN // ―――――――――――――――――――――――――――――――― bool yn(const bool b) { if (b) { Yes; } else { No; } return b; } bool YN(const bool b) { if (b) { YES; } else { NO; } return b; } // ―――――――――――――――――――――――――――――――― // amax, amin // ―――――――――――――――――――――――――――――――― template <class T> bool amax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; } template <class T> bool amin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; } // ―――――――――――――――――――――――――――――――― // input // ―――――――――――――――――――――――――――――――― template <typename T> void input(T& n) { cin >> n; } template <typename T> void input(V<T>& v, const int n) { T value; for (int i = 0; i < n; ++i) { input(value); v.push_back(value); } } template <typename T> void input(VV<T>& v, const int h, const int w) { V<T> vec; for (int i = 0; i < h; i++) { vec.clear(); input(vec, w); v.push_back(vec); } } template <typename T, typename U> void input(P<T, U>& p) { cin >> p.first >> p.second; } template <typename T, typename... Args> void input(T& first, Args&... args) { input(first); if constexpr (sizeof...(args) > 0) { input(args...); } } template <typename T> void input(set<T>& s, const int n) { for (int i = 0; i < n; ++i) { T value; input(value); s.insert(value); } } template <typename T> void input(multiset<T>& s, const int n) { for (int i = 0; i < n; ++i) { T value; input(value); s.insert(value); } } template <typename T> void input(unordered_set<T>& s, const int n) { for (int i = 0; i < n; ++i) { T value; input(value); s.insert(value); } } template <typename K, typename T> void input(map<K, T>& m, const int n) { for (int i = 0; i < n; ++i) { K k; T v; input(k, v); m.emplace(k, v); } } template <typename K, typename T> void input(unordered_map<K, T>& m, const int n) { for (int i = 0; i < n; ++i) { K k; T v; input(k, v); m.emplace(k, v); } } // ―――――――――――――――――――――――――――――――― // print // ―――――――――――――――――――――――――――――――― template <typename T> void print(const T& value, bool endline = true) { if constexpr (is_same_v<T, bool>) { cout << (value ? "true" : "false"); } else { cout << value; } if (endline) { cout << el; } } template <typename T> void print(const V<T>& vec, bool endline = true) { for (size_t i = 0; i < vec.size(); ++i) { print(vec[i], false); if (i != vec.size() - 1) { cout << spa; } } if (endline) { cout << el; } } template <typename T, typename U> void print(const P<T, U>& p, bool endline = true) { cout << p.first << spa << p.second; if (endline) { cout << el; } } template <size_t Index = 0, typename... T> void print_tuple(const tuple<T...>& tpl) { if constexpr (Index < sizeof...(T)) { print(get<Index>(tpl), false); if constexpr (Index < sizeof...(T) - 1) cout << spa; print_tuple<Index + 1>(tpl); } } template <typename... T> void print(const tuple<T...>& tpl, bool endline = true) { print_tuple(tpl); if (endline) cout << el; } template <typename T, typename... Args> void print(const T& first, Args&... args) { print(first, false); cout << spa; if constexpr (sizeof...(args) > 0) { print(args...); } } // ―――――――――――――――――――――――――――――――― // debug // ―――――――――――――――――――――――――――――――― template <typename T> void debug(const T& value, bool endline = true) { if constexpr (is_same_v<T, bool>) { cerr << (value ? "true" : "false"); } else { cerr << value; } if (endline) { cerr << el; } } template <typename T> void debug(const V<T>& vec, bool endline = true) { for (size_t i = 0; i < vec.size(); ++i) { debug(vec[i], false); if (i != vec.size() - 1) { cerr << spa; } } if (endline) { cerr << el; } } template <typename T, typename U> void debug(const P<T, U>& p, bool endline = true) { cerr << p.first << spa << p.second; if (endline) { cerr << el; } } template <size_t Index = 0, typename... T> void debug_tuple(const tuple<T...>& tpl) { if constexpr (Index < sizeof...(T)) { debug(get<Index>(tpl), false); if constexpr (Index < sizeof...(T) - 1) cerr << spa; debug_tuple<Index + 1>(tpl); } } template <typename... T> void debug(const tuple<T...>& tpl, bool endline = true) { debug_tuple(tpl); if (endline) cerr << el; } template <typename T, typename... Args> void debug(const T& first, Args&... args) { debug(first, false); cerr << spa; if constexpr (sizeof...(args) > 0) { debug(args...); } } template <typename Iter> auto sum(Iter begin, Iter end) { using T = typename iterator_traits<Iter>::value_type; return accumulate(begin, end, T{}); } // ―――――――――――――――――――――――――――――――― // mod_pow // ―――――――――――――――――――――――――――――――― template <typename T> T mod_pow(T x, T n, const T& p) { T ret = 1; while (n > 0) { if (n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; } // ―――――――――――――――――――――――――――――――― // monoid // ―――――――――――――――――――――――――――――――― using MS = int; using MF = int; MS op(MS l, MS r) { return min(l, r); } MS e() { return INF; } MS mapping(MF l, MS r) { return r + l; } MF composition(MF l, MF r) { return l + r; } MF id() { return 0; } // ―――――――――――――――――――――――――――――――― // ACL // ―――――――――――――――――――――――――――――――― // #include <atcoder/convolution> // #include <atcoder/dsu> // #include <atcoder/fenwicktree> // #include <atcoder/lazysegtree> // #include <atcoder/math> // #include <atcoder/maxflow> // #include <atcoder/mincostflow> // #include <atcoder/modint> // #include <atcoder/scc> // #include <atcoder/segtree> // #include <atcoder/string> // #include <atcoder/twosat> // using namespace atcoder; // using mint = modint998244353; int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); int N; ll ans; input(N); if ((N % 10) == 0) { string S; input(S); int M = N / 10; vl dp(M + 1, 0); dp[0] = 1; rep(i, M) { if (S[10 * i] == 'o') { REG(k, 1, M - i) { if (S[10 * i + 2 * k] == 'o' && S[10 * i + 5 * k] == 'o' && S[10 * i + 10 * k] == 'o') { dp[i + k] += dp[i]; dp[i + k] %= MOD; } } } } // debug(dp); ans = dp[M]; } else { ans = 0; } print(ans); return 0; }