結果

問題 No.2729 Addition and Multiplication in yukicoder (Easy)
ユーザー kikueplkikuepl
提出日時 2024-04-19 21:45:07
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 196 ms / 2,000 ms
コード長 983 bytes
コンパイル時間 6,094 ms
コンパイル使用メモリ 338,344 KB
実行使用メモリ 19,156 KB
最終ジャッジ日時 2024-04-19 21:45:19
合計ジャッジ時間 9,609 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 188 ms
19,028 KB
testcase_03 AC 108 ms
14,672 KB
testcase_04 AC 116 ms
14,804 KB
testcase_05 AC 124 ms
14,800 KB
testcase_06 AC 196 ms
19,156 KB
testcase_07 AC 142 ms
14,804 KB
testcase_08 AC 181 ms
19,028 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 193 ms
19,028 KB
testcase_13 AC 190 ms
18,900 KB
testcase_14 AC 193 ms
19,152 KB
testcase_15 AC 193 ms
19,084 KB
testcase_16 AC 135 ms
18,772 KB
testcase_17 AC 135 ms
18,640 KB
testcase_18 AC 191 ms
18,640 KB
testcase_19 AC 134 ms
18,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*****/
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace atcoder;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define all(x) begin(x),end(x)

const int MOD = 1e9 + 7;
const int mod = 998244353;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
/*****/

int n;
ll a[200009];
int main()
{
  cin >> n;
  vector<pair<string,ll>> pll;
  rep(i,0,n)
  {
    cin >> a[i];
    pll.push_back(make_pair(to_string(a[i]), a[i]));
  }
  sort(all(pll),[](const pair<string, ll>&a, const pair<string, ll> &b)
  {
    if (a.first.length() == b.first.length()) return a.second < b.second;
    return a.first.length() < b.first.length();
  });
  ll ans = 0;
  for (auto& [s,num]:pll)
  {
    ans = (ans*10+num)%mod;
  }
  cout << ans << endl;
}
0