結果
問題 | No.2734 Addition and Multiplication in yukicoder (Hard) |
ユーザー | 🦠みどりむし |
提出日時 | 2024-04-05 17:11:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,977 ms / 5,000 ms |
コード長 | 1,661 bytes |
コンパイル時間 | 186 ms |
コンパイル使用メモリ | 81,828 KB |
実行使用メモリ | 129,952 KB |
最終ジャッジ日時 | 2024-04-05 17:12:37 |
合計ジャッジ時間 | 32,560 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
55,608 KB |
testcase_01 | AC | 41 ms
55,608 KB |
testcase_02 | AC | 36 ms
55,608 KB |
testcase_03 | AC | 40 ms
55,608 KB |
testcase_04 | AC | 36 ms
55,608 KB |
testcase_05 | AC | 36 ms
55,608 KB |
testcase_06 | AC | 37 ms
55,608 KB |
testcase_07 | AC | 36 ms
55,608 KB |
testcase_08 | AC | 35 ms
55,608 KB |
testcase_09 | AC | 36 ms
55,608 KB |
testcase_10 | AC | 36 ms
55,608 KB |
testcase_11 | AC | 35 ms
55,608 KB |
testcase_12 | AC | 38 ms
55,608 KB |
testcase_13 | AC | 36 ms
55,608 KB |
testcase_14 | AC | 36 ms
55,608 KB |
testcase_15 | AC | 38 ms
55,608 KB |
testcase_16 | AC | 36 ms
55,608 KB |
testcase_17 | AC | 1,226 ms
107,880 KB |
testcase_18 | AC | 1,237 ms
123,064 KB |
testcase_19 | AC | 40 ms
57,696 KB |
testcase_20 | AC | 39 ms
57,696 KB |
testcase_21 | AC | 39 ms
57,696 KB |
testcase_22 | AC | 1,947 ms
129,848 KB |
testcase_23 | AC | 1,885 ms
129,824 KB |
testcase_24 | AC | 1,903 ms
129,952 KB |
testcase_25 | AC | 1,977 ms
129,836 KB |
testcase_26 | AC | 1,919 ms
129,840 KB |
testcase_27 | AC | 1,789 ms
127,500 KB |
testcase_28 | AC | 1,938 ms
129,052 KB |
testcase_29 | AC | 1,899 ms
129,116 KB |
testcase_30 | AC | 1,658 ms
125,976 KB |
testcase_31 | AC | 1,918 ms
129,804 KB |
testcase_32 | AC | 1,750 ms
127,856 KB |
testcase_33 | AC | 1,205 ms
113,560 KB |
testcase_34 | AC | 1,525 ms
122,500 KB |
testcase_35 | AC | 771 ms
96,472 KB |
testcase_36 | AC | 796 ms
98,288 KB |
testcase_37 | AC | 1,280 ms
114,496 KB |
testcase_38 | AC | 1,206 ms
113,904 KB |
ソースコード
# @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 template import sys from 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 = -1 self.buffer = [] self.source = source def one(self): self.pos += 1 if 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], 1 if isinstance(tp, int): tp, count = str, tp if 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) #endregion n = int(input()) A = [*map(int, input().split())] ans = 0 A.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 %= 998244353 ans += a ans %= 998244353 print(ans)