結果

問題 No.2055 12x34...
ユーザー Kohenyan_proKohenyan_pro
提出日時 2022-08-21 12:59:43
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 5,063 bytes
コンパイル時間 2,835 ms
コンパイル使用メモリ 210,172 KB
最終ジャッジ日時 2024-04-18 12:45:37
合計ジャッジ時間 3,567 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/string:43,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bitset:52,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/x86_64-pc-linux-gnu/bits/stdc++.h:52,
                 from main.cpp:5:
/home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/allocator.h: In destructor 'std::__cxx11::basic_string<char>::_Alloc_hider::~_Alloc_hider()':
/home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = char]': target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/string:54:
/home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/basic_string.h:181:14: note: called from here
  181 |       struct _Alloc_hider : allocator_type // TODO check __is_final
      |              ^~~~~~~~~~~~

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
using mint2 = modint998244353;
using ll = long long;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353LL;
#define all(a) (a).begin(), (a).end()
#define cin_vec(x)                       \
    for (ll I1 = 0; I1 < x.size(); I1++) \
    {                                    \
        cin >> x[I1];                    \
    }
#define cout_vecn(x)                     \
    for (ll I1 = 0; I1 < x.size(); I1++) \
    {                                    \
        cout << x[I1] << endl;           \
    }
#define cout_vec(x)                      \
    for (ll I1 = 0; I1 < x.size(); I1++) \
    {                                    \
        cout << x[I1] << " ";            \
    }                                    \
    cout << endl;

ll powmod(ll a, ll n, ll mod)
{
    ll res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll gcd(ll x, ll y)
{
    if (x < y)
        swap(x, y);
    // xの方が常に大きい
    ll r;
    while (y > 0)
    {
        r = x % y;
        x = y;
        y = r;
    }
    return x;
}
//オーバフローしないようにかける順番を気を付ける
ll lcm(ll x, ll y)
{
    return ll(x / gcd(x, y)) * y;
}
ll gcd_vec(vector<ll> const &A)
{ // N個の要素に対する最大公約数
    ll size = (ll)A.size();
    ll ret = A[0];
    for (ll i = 1; i < size; i++)
    {
        ret = gcd(ret, A[i]);
    }
    return ret;
}
ll lcm_vec(vector<ll> const &A)
{ // N個の要素に対する最大公約数
    ll size = A.size();
    ll ret = A[0];
    for (ll i = 1; i < size; i++)
    {
        ret = lcm(ret, A[i]);
    }
    return ret;
}
bool is_prime(ll N)
{
    if (N == 1)
        return false;
    for (ll i = 2; i * i <= N; ++i)
    {
        if (N % i == 0)
            return false;
    }
    return true;
}
ll GetDigit(ll num) //桁数
{
    ll digit = 0;
    while (num != 0)
    {
        num /= 10;
        digit++;
    }
    return digit;
}
string convert(ll x, ll y)
{
    string res;
    while (x > 0)
    {
        res.push_back('0' + (x % y));
        x /= y;
    }
    reverse(res.begin(), res.end());
    return res;
}
ll modinv(ll a, ll m)
{
    ll b = m, u = 1, v = 0;
    while (b)
    {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}
using Graph = vector<vector<ll>>;
struct Edge
{
    ll to;
    ll w;
    Edge(ll to, ll w) : to(to), w(w) {}
}; //辺にコストがあるグラフ
const int MAX = 200000;
ll fact[MAX], inv_fact[MAX], inv[MAX];
ll Mod;
void init(ll mod)
{
    // 初期値設定と1はじまりインデックスに直す
    fact[0] = 1;
    fact[1] = 1;
    inv[0] = 1;
    inv[1] = 1;
    inv_fact[0] = 1;
    inv_fact[1] = 1;
    // メモの計算
    for (int i = 2; i < MAX; i++)
    {
        // 階乗
        fact[i] = fact[i - 1] * i % mod;
        // 逆元
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        // 逆元の階乗
        inv_fact[i] = inv_fact[i - 1] * inv[i] % mod;
    }
    Mod = mod;
}
ll nCk(ll n, ll k)
{
    if (n < k || k < 0)
        return 0;                                                   // 例外処理
    return fact[n] * ((inv_fact[n - k] * inv_fact[k]) % Mod) % Mod; //二項係数の計算
}
ll nHk(ll n, ll k)
{
    if (n == 0 && k == 0)
        return 1;
    if (n < 0 || k < 0)
        return 0;
    return nCk(n + k - 1, k);
}
ll nPk(ll n, ll k)
{
    if (n < k || k < 0)
        return 0;                       // 例外処理
    return fact[n] * inv_fact[k] % Mod; //二項係数の計算
}
string fix(ll x, ll y)
{
    string s = to_string(x);
    string ans;
    for (int i = 0; i < y - s.size(); i++)
    {
        ans.push_back('0');
    }
    ans += s;
    return ans;
}
vector<pair<ll, ll>> rle(vector<ll> s)
{
    vector<pair<ll, ll>> vec;
    int cnt = 1;
    for (int i = 1; i < (int)s.size(); i++)
    {
        if (s[i] != s[i - 1])
        {
            vec.push_back({s[i - 1], cnt});
            cnt = 0;
        }
        cnt++;
    }
    vec.push_back({s[s.size() - 1], cnt});
    return vec;
}
#define repa for (int i = 0; i < a; i++)
#define rep(i, x, a) for (int(i) = (x); (i) < (a); (i)++)
#define rep0(i, a) for (int(i) = 0; i < (a); (i)++)
#define repaj(i) for (int(i) = 0; i < a; (i)++)
// cout<<fixed<<setprecision(15);
int main()
{
    ll a;
    cin >> a;
    vector<ll> x(a);
    cin_vec(x);
    map<ll, mint2> y;
    for (int i = 0; i < a; i++)
    {
        y[x[i]] += y[x[i] - 1];
        y[x[i]]++;
    }
    mint2 b = 0;
    for (auto X : y)
    {
        b += X.second;
    }
    b -= a;
    cout << b.val() << endl;
}
0