結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
ユーザー FplusFplusFFplusFplusF
提出日時 2024-04-05 17:29:24
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 779 ms / 5,000 ms
コード長 910 bytes
コンパイル時間 3,408 ms
コンパイル使用メモリ 258,296 KB
実行使用メモリ 23,048 KB
最終ジャッジ日時 2024-04-05 17:29:42
合計ジャッジ時間 14,930 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 1 ms
6,548 KB
testcase_06 AC 2 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 1 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 1 ms
6,548 KB
testcase_11 AC 2 ms
6,548 KB
testcase_12 AC 1 ms
6,548 KB
testcase_13 AC 1 ms
6,548 KB
testcase_14 AC 3 ms
6,548 KB
testcase_15 AC 2 ms
6,548 KB
testcase_16 AC 2 ms
6,548 KB
testcase_17 AC 221 ms
11,568 KB
testcase_18 AC 225 ms
11,568 KB
testcase_19 AC 1 ms
6,548 KB
testcase_20 AC 1 ms
6,548 KB
testcase_21 AC 1 ms
6,548 KB
testcase_22 AC 731 ms
23,048 KB
testcase_23 AC 759 ms
23,048 KB
testcase_24 AC 771 ms
23,048 KB
testcase_25 AC 779 ms
23,044 KB
testcase_26 AC 765 ms
23,048 KB
testcase_27 AC 596 ms
20,188 KB
testcase_28 AC 749 ms
22,080 KB
testcase_29 AC 692 ms
21,900 KB
testcase_30 AC 552 ms
18,488 KB
testcase_31 AC 714 ms
22,556 KB
testcase_32 AC 648 ms
22,528 KB
testcase_33 AC 339 ms
13,104 KB
testcase_34 AC 512 ms
19,152 KB
testcase_35 AC 193 ms
8,956 KB
testcase_36 AC 192 ms
9,140 KB
testcase_37 AC 419 ms
17,272 KB
testcase_38 AC 363 ms
13,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> inline bool chmin(T &a,T b){
    if(a>b){
        a=b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T &a,T b){
    if(a<b){
        a=b;
        return true;
    }
    return false;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    const ll mod=998244353;
    ll n;
    cin >> n;
    vector<string> a(n);
    rep(i,n) cin >> a[i];
    sort(all(a),[&](string i,string j){return i+j<j+i;});
    string s;
    rep(i,n) s+=a[i];
    reverse(all(s));
    ll ans=0,r=1;
    for(auto i:s){
        ans+=(i-'0')*r%mod;
        ans%=mod;
        r*=10;
        r%=mod;
    }
    cout << ans << '\n';
}
0