結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
ユーザー SPD_9X2
提出日時 2024-04-19 23:04:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,721 ms / 5,000 ms
コード長 503 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,488 KB
実行使用メモリ 127,716 KB
最終ジャッジ日時 2024-10-11 17:14:38
合計ジャッジ時間 31,535 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

based on
https://yamate11.github.io/blog/posts/2021/11-03-abc225-f-string-cards/

"""

N = list(map(int,input().split()))

A = list(input().split())

from functools import cmp_to_key

from functools import cmp_to_key

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

B = list(sorted(A, key=cmp_to_key(cmp)))

ans = "".join(B)
mod = 998244353

x = 0
for c in ans:
    x *= 10
    x += int(c)
    x %= mod

print (x)
0