結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
ユーザー budoubudou
提出日時 2024-04-20 09:38:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,362 ms / 5,000 ms
コード長 689 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 82,256 KB
実行使用メモリ 123,756 KB
最終ジャッジ日時 2024-04-20 09:39:06
合計ジャッジ時間 41,293 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
67,200 KB
testcase_01 AC 65 ms
67,200 KB
testcase_02 AC 64 ms
67,456 KB
testcase_03 AC 65 ms
67,584 KB
testcase_04 AC 64 ms
67,200 KB
testcase_05 AC 81 ms
67,456 KB
testcase_06 AC 66 ms
67,456 KB
testcase_07 AC 66 ms
67,432 KB
testcase_08 AC 65 ms
67,200 KB
testcase_09 AC 66 ms
67,584 KB
testcase_10 AC 66 ms
67,200 KB
testcase_11 AC 65 ms
67,584 KB
testcase_12 AC 66 ms
67,200 KB
testcase_13 AC 65 ms
67,456 KB
testcase_14 AC 65 ms
67,584 KB
testcase_15 AC 67 ms
67,200 KB
testcase_16 AC 64 ms
67,840 KB
testcase_17 AC 1,710 ms
117,568 KB
testcase_18 AC 1,686 ms
118,572 KB
testcase_19 AC 77 ms
69,120 KB
testcase_20 AC 70 ms
69,120 KB
testcase_21 AC 75 ms
68,992 KB
testcase_22 AC 2,362 ms
123,756 KB
testcase_23 AC 2,330 ms
123,436 KB
testcase_24 AC 2,268 ms
123,528 KB
testcase_25 AC 2,310 ms
123,420 KB
testcase_26 AC 2,312 ms
123,620 KB
testcase_27 AC 2,178 ms
122,112 KB
testcase_28 AC 2,284 ms
123,232 KB
testcase_29 AC 2,278 ms
122,792 KB
testcase_30 AC 2,061 ms
122,112 KB
testcase_31 AC 2,286 ms
123,312 KB
testcase_32 AC 2,106 ms
121,856 KB
testcase_33 AC 1,458 ms
114,696 KB
testcase_34 AC 1,786 ms
120,320 KB
testcase_35 AC 1,023 ms
99,760 KB
testcase_36 AC 1,061 ms
102,120 KB
testcase_37 AC 1,527 ms
115,384 KB
testcase_38 AC 1,469 ms
115,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import typing
import sys
from collections import defaultdict, deque
import heapq
from functools import cmp_to_key
input = lambda: sys.stdin.readline().strip()
inf = 10**18
mod = 998244353
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
# sys.setrecursionlimit(10**6)


def solve():
  def cmp(x, y):
    a = pow(10, len(y))*int(x) + int(y)
    b = pow(10, len(x))*int(y) + int(x)
    if a > b:
      return 1
    if a < b:
      return -1
    return 0

  N = int(input())
  l = input().split()
  l.sort(key=cmp_to_key(cmp))
  ans = 0
  for x in l:
    ans = pow(10, len(x))*ans + int(x)
    ans %= mod
  print(ans)
def main():
  t = 1
  for _ in range(t):
    solve()
main()
0