結果
問題 | No.2729 Addition and Multiplication in yukicoder (Easy) |
ユーザー | kikuepl |
提出日時 | 2024-04-19 21:45:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 213 ms / 2,000 ms |
コード長 | 983 bytes |
コンパイル時間 | 5,978 ms |
コンパイル使用メモリ | 317,688 KB |
実行使用メモリ | 19,032 KB |
最終ジャッジ日時 | 2024-10-11 14:39:09 |
合計ジャッジ時間 | 9,392 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
/*****/ #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; }