結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
ユーザー GGanariGGanari
提出日時 2024-04-20 00:08:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 301 ms / 5,000 ms
コード長 874 bytes
コンパイル時間 2,863 ms
コンパイル使用メモリ 207,888 KB
実行使用メモリ 23,656 KB
最終ジャッジ日時 2024-04-20 00:08:34
合計ジャッジ時間 8,447 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 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 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 236 ms
23,652 KB
testcase_18 AC 237 ms
23,400 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 275 ms
23,524 KB
testcase_23 AC 275 ms
23,652 KB
testcase_24 AC 280 ms
23,524 KB
testcase_25 AC 286 ms
23,396 KB
testcase_26 AC 278 ms
23,652 KB
testcase_27 AC 263 ms
23,524 KB
testcase_28 AC 275 ms
23,656 KB
testcase_29 AC 301 ms
23,524 KB
testcase_30 AC 276 ms
23,524 KB
testcase_31 AC 277 ms
23,520 KB
testcase_32 AC 250 ms
22,376 KB
testcase_33 AC 183 ms
21,860 KB
testcase_34 AC 217 ms
21,600 KB
testcase_35 AC 120 ms
13,900 KB
testcase_36 AC 159 ms
15,076 KB
testcase_37 AC 196 ms
21,604 KB
testcase_38 AC 189 ms
21,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define INF 1000000001LL
#define LNF 1000000000000000001LL
#define MOD 998244353LL
#define MAX 1005
#define long long long
#define all(x) x.begin(),x.end()
using namespace std;


int main()
{
	ios_base::sync_with_stdio(0); 
    cin.tie(0);
    
    
    int n;
    cin >> n;

    vector<pair<string,long>> arr;

    for(int i = 0; i<n; i++)
    {
        long x;
        cin >> x;
        string s;
        string strX = to_string(x);
        for(int j = 0; j < 50; j++)
            s.push_back(strX[j%strX.size()]);
        arr.push_back({s,x});
    }
    sort(all(arr));
    long res = 0;
    for(int i = 0; i<n; i++)
    {
        long x = arr[i].second;
        while(x)
        {
            res*=10;
            res%=MOD;
            x/=10;
        }
        res+=arr[i].second;
        res%=MOD;
    }
    cout << res << endl;
    return 0;
}
0