結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
ユーザー 👑 nu50218nu50218
提出日時 2024-04-19 22:46:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 508 ms / 5,000 ms
コード長 1,074 bytes
コンパイル時間 2,423 ms
コンパイル使用メモリ 205,528 KB
実行使用メモリ 18,856 KB
最終ジャッジ日時 2024-04-19 22:47:08
合計ジャッジ時間 10,881 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 250 ms
9,512 KB
testcase_18 AC 236 ms
9,520 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 489 ms
18,688 KB
testcase_23 AC 497 ms
18,692 KB
testcase_24 AC 469 ms
18,856 KB
testcase_25 AC 508 ms
18,684 KB
testcase_26 AC 461 ms
18,804 KB
testcase_27 AC 406 ms
15,940 KB
testcase_28 AC 492 ms
17,836 KB
testcase_29 AC 472 ms
17,760 KB
testcase_30 AC 389 ms
14,292 KB
testcase_31 AC 481 ms
18,412 KB
testcase_32 AC 432 ms
16,772 KB
testcase_33 AC 258 ms
10,984 KB
testcase_34 AC 377 ms
13,744 KB
testcase_35 AC 156 ms
7,820 KB
testcase_36 AC 160 ms
7,912 KB
testcase_37 AC 293 ms
12,368 KB
testcase_38 AC 270 ms
11,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifdef LOCAL
#include <local.hpp>
#else
#include <bits/stdc++.h>
#define debug(...) ((void)0)
#define postprocess(...) ((void)0)
#endif

#include <atcoder/modint.hpp>
using mint = atcoder::modint998244353;
namespace atcoder {
template <int m, std::enable_if_t<(1 <= m)>* = nullptr>
std::ostream& operator<<(std::ostream& os, const static_modint<m>& x) {
    return os << x.val();
}
}  // namespace atcoder

using namespace std;
using ll = long long;
using ld = long double;

void solve([[maybe_unused]] int test) {
    int N;
    cin >> N;

    vector<string> S(N);
    for (auto&& x : S) {
        cin >> x;
    }
    sort(S.begin(), S.end(), [](const string& a, const string& b) {
        return a + b < b + a;
    });

    mint ans = 0;
    for (auto&& x : S) {
        for (auto&& c : x) {
            ans *= 10;
            ans += (c - '0');
        }
    }

    cout << ans << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {
        solve(i);
    }

    postprocess();
}
0