結果
問題 | No.2734 Addition and Multiplication in yukicoder (Hard) |
ユーザー |
![]() |
提出日時 | 2024-04-05 17:11:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,664 ms / 5,000 ms |
コード長 | 1,661 bytes |
コンパイル時間 | 411 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 130,496 KB |
最終ジャッジ日時 | 2024-10-01 01:21:50 |
合計ジャッジ時間 | 39,793 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 36 |
ソースコード
# @uni_kakurenbo# https://github.com/uni-kakurenbo/competitive-programming-workspace## CC0 1.0 http://creativecommons.org/publicdomain/zero/1.0/deed.ja# #language PyPy ##region templateimport sysfrom functools import cmp_to_key# sys.setrecursionlimit(10**5)def debug(*args, **opts):if "LOCAL_JUDGE" in sys.argv: print(*args, **opts, file=sys.stderr)class istream():def __init__(self, source=sys.stdin):self.pos = -1self.buffer = []self.source = sourcedef one(self):self.pos += 1if self.pos >= len(self.buffer): self.buffer.extend(self.source.readline().split())return self.buffer[self.pos]def __call__(self, *types):if len(types) == 0: return str(self.one())if len(types) == 1:tp, count = types[0], 1if isinstance(tp, int):tp, count = str, tpif count == 1:return tp(self.one())else:return tuple(tp(self.one()) for _ in [0] * count)if len(types) == 2 and isinstance(types[1], int):return tuple(types[0](self.one()) for _ in [0] * types[1])return tuple(map(lambda type: type(self.one()), types))def line(self, type):return tuple(map(type, self.source.readline().split()))cin = istream()# setrecursionlimit(10**5)#endregionn = int(input())A = [*map(int, input().split())]ans = 0A.sort(key=cmp_to_key(lambda x, y: (10**len(str(y)) * x + y) - (10**len(str(x)) * y + x)))debug(A)for a in A:ans *= 10**len(str(a))ans %= 998244353ans += aans %= 998244353print(ans)