結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
ユーザー AngrySadEightAngrySadEight
提出日時 2024-03-18 14:22:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,774 ms / 5,000 ms
コード長 438 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 130,324 KB
最終ジャッジ日時 2024-03-18 14:23:28
合計ジャッジ時間 32,137 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
55,604 KB
testcase_01 AC 49 ms
55,604 KB
testcase_02 AC 45 ms
55,604 KB
testcase_03 AC 45 ms
55,604 KB
testcase_04 AC 44 ms
55,604 KB
testcase_05 AC 44 ms
55,604 KB
testcase_06 AC 44 ms
55,604 KB
testcase_07 AC 44 ms
55,604 KB
testcase_08 AC 44 ms
55,604 KB
testcase_09 AC 44 ms
55,604 KB
testcase_10 AC 44 ms
55,604 KB
testcase_11 AC 45 ms
55,604 KB
testcase_12 AC 48 ms
55,604 KB
testcase_13 AC 45 ms
55,604 KB
testcase_14 AC 44 ms
55,604 KB
testcase_15 AC 44 ms
55,604 KB
testcase_16 AC 45 ms
55,604 KB
testcase_17 AC 1,631 ms
114,496 KB
testcase_18 AC 1,637 ms
122,976 KB
testcase_19 AC 47 ms
55,604 KB
testcase_20 AC 46 ms
55,604 KB
testcase_21 AC 45 ms
55,604 KB
testcase_22 AC 1,716 ms
130,324 KB
testcase_23 AC 1,680 ms
130,288 KB
testcase_24 AC 1,754 ms
130,288 KB
testcase_25 AC 1,747 ms
130,304 KB
testcase_26 AC 1,726 ms
130,304 KB
testcase_27 AC 1,739 ms
128,148 KB
testcase_28 AC 1,734 ms
130,032 KB
testcase_29 AC 1,774 ms
129,560 KB
testcase_30 AC 1,719 ms
125,872 KB
testcase_31 AC 1,736 ms
130,052 KB
testcase_32 AC 1,686 ms
129,008 KB
testcase_33 AC 1,270 ms
112,516 KB
testcase_34 AC 1,473 ms
123,140 KB
testcase_35 AC 864 ms
101,284 KB
testcase_36 AC 922 ms
103,572 KB
testcase_37 AC 1,275 ms
113,316 KB
testcase_38 AC 1,268 ms
112,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import cmp_to_key

def comp(a, b):
    if a + b < b + a:
        return -1
    elif a + b == b + a:
        return 0
    else:
        return 1

N = int(input())
A = list(map(str, input().split()))
A.sort(key=cmp_to_key(comp))

mod = 998244353

pow_10 = [pow(10, i, mod) for i in range(19)]

now = 0
for i in range(N):
    len_a = len(A[i])
    now = (now * pow_10[len_a]) % mod
    now = (now + int(A[i])) % mod
print(now)
0