結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
ユーザー cled0328cled0328
提出日時 2024-04-19 22:48:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 448 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 2,963 ms
コンパイル使用メモリ 213,468 KB
実行使用メモリ 34,688 KB
最終ジャッジ日時 2024-04-19 22:48:54
合計ジャッジ時間 11,249 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 448 ms
34,472 KB
testcase_18 AC 414 ms
34,560 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 417 ms
34,612 KB
testcase_23 AC 392 ms
34,688 KB
testcase_24 AC 396 ms
34,544 KB
testcase_25 AC 423 ms
34,560 KB
testcase_26 AC 390 ms
34,560 KB
testcase_27 AC 416 ms
34,560 KB
testcase_28 AC 434 ms
34,560 KB
testcase_29 AC 403 ms
34,688 KB
testcase_30 AC 424 ms
34,432 KB
testcase_31 AC 418 ms
34,560 KB
testcase_32 AC 379 ms
32,664 KB
testcase_33 AC 315 ms
26,624 KB
testcase_34 AC 352 ms
30,116 KB
testcase_35 AC 232 ms
19,712 KB
testcase_36 AC 256 ms
21,632 KB
testcase_37 AC 310 ms
26,956 KB
testcase_38 AC 320 ms
26,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using mint=modint998244353;

int main(){
    int n;cin>>n;
    vector<long long> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    vector<pair<string,long long>> srt(n);
    for(int i=0;i<n;i++){
        srt[i]={to_string(a[i]),a[i]};
        while(srt[i].first.length()<100)srt[i].first=srt[i].first+to_string(a[i]);
        srt[i].first=srt[i].first.substr(0,100);
    }
    sort(srt.begin(),srt.end());
    mint ans=0;
    vector<mint> pw(20);
    pw[0]=1;
    for(int i=0;i<19;i++)pw[i+1]=pw[i]*10;
    for(int i=0;i<n;i++){
        ans*=pw[to_string(srt[i].second).length()];
        ans+=srt[i].second;
    }
    cout<<ans.val()<<"\n";
}
0