結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
ユーザー PNJPNJ
提出日時 2024-04-19 22:25:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,595 ms / 5,000 ms
コード長 409 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 131,144 KB
最終ジャッジ日時 2024-04-19 22:25:40
合計ジャッジ時間 28,594 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
54,656 KB
testcase_01 AC 43 ms
54,400 KB
testcase_02 AC 46 ms
54,400 KB
testcase_03 AC 51 ms
54,656 KB
testcase_04 AC 52 ms
54,400 KB
testcase_05 AC 53 ms
54,656 KB
testcase_06 AC 43 ms
54,272 KB
testcase_07 AC 48 ms
54,400 KB
testcase_08 AC 48 ms
54,400 KB
testcase_09 AC 43 ms
54,656 KB
testcase_10 AC 48 ms
54,528 KB
testcase_11 AC 41 ms
54,272 KB
testcase_12 AC 48 ms
54,784 KB
testcase_13 AC 43 ms
54,656 KB
testcase_14 AC 41 ms
54,272 KB
testcase_15 AC 43 ms
54,272 KB
testcase_16 AC 46 ms
54,528 KB
testcase_17 AC 1,453 ms
114,944 KB
testcase_18 AC 1,419 ms
123,564 KB
testcase_19 AC 43 ms
55,040 KB
testcase_20 AC 46 ms
55,040 KB
testcase_21 AC 43 ms
55,296 KB
testcase_22 AC 1,595 ms
130,900 KB
testcase_23 AC 1,534 ms
130,628 KB
testcase_24 AC 1,558 ms
130,756 KB
testcase_25 AC 1,520 ms
131,144 KB
testcase_26 AC 1,499 ms
130,768 KB
testcase_27 AC 1,457 ms
128,480 KB
testcase_28 AC 1,505 ms
130,364 KB
testcase_29 AC 1,542 ms
129,908 KB
testcase_30 AC 1,520 ms
126,208 KB
testcase_31 AC 1,568 ms
130,636 KB
testcase_32 AC 1,470 ms
129,860 KB
testcase_33 AC 1,107 ms
112,980 KB
testcase_34 AC 1,300 ms
123,484 KB
testcase_35 AC 735 ms
101,248 KB
testcase_36 AC 874 ms
103,936 KB
testcase_37 AC 1,149 ms
113,780 KB
testcase_38 AC 1,189 ms
113,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import cmp_to_key
def cmp(a, b):
    if a + b > b + a:
      s = 1
    elif a + b == b + a:
      s = 0
    else:
      s = -1
    return 1 if s > 0 else -1 if s < 0 else 0

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

ans = 0
mod = 998244353
for i in range(N):
  d = len(A[i])
  ans *= pow(10,d,mod)
  ans %= mod
  ans += int(A[i])
  ans %= mod
print(ans)
0