結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
ユーザー CaiiiiiiiiCaiiiiiiii
提出日時 2024-04-19 22:31:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 99 ms / 5,000 ms
コード長 601 bytes
コンパイル時間 2,174 ms
コンパイル使用メモリ 200,752 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2024-04-19 22:31:20
合計ジャッジ時間 5,377 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 68 ms
9,472 KB
testcase_18 AC 74 ms
9,600 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 96 ms
9,600 KB
testcase_23 AC 96 ms
9,728 KB
testcase_24 AC 99 ms
9,728 KB
testcase_25 AC 95 ms
9,576 KB
testcase_26 AC 93 ms
9,472 KB
testcase_27 AC 81 ms
9,472 KB
testcase_28 AC 87 ms
9,472 KB
testcase_29 AC 85 ms
9,472 KB
testcase_30 AC 78 ms
9,600 KB
testcase_31 AC 87 ms
9,612 KB
testcase_32 AC 78 ms
9,088 KB
testcase_33 AC 55 ms
7,808 KB
testcase_34 AC 70 ms
8,704 KB
testcase_35 AC 37 ms
6,656 KB
testcase_36 AC 39 ms
7,040 KB
testcase_37 AC 61 ms
7,936 KB
testcase_38 AC 56 ms
8,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

typedef long long LL;
typedef __int128 LLL;

const int N = 10;
const int MOD = 998244353;

int n;

int main() {

  scanf("%d", &n);
  std::vector<std::pair<LL, LLL>> a(n);
  for(auto &[x, y]: a) {
    scanf("%lld", &x);
    LL t = x;
    y = 1;
    while(t) {
      t /= 10;
      y *= 10;
    }
  }

  std::sort(a.begin(), a.end(), [] (const auto &s, const auto &t) {
				  auto &&[x, y] = s;
				  auto &&[p, q] = t;
				  return x * q + p < y * p + x;});

  int ans = 0;
  for(auto &&[x, y]: a)
    ans = (ans * y + x) % MOD;  
  
  printf("%d\n", ans);
  
  return 0;

}
0