結果
| 問題 |
No.2734 Addition and Multiplication in yukicoder (Hard)
|
| コンテスト | |
| ユーザー |
cled0328
|
| 提出日時 | 2024-04-19 22:45:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 733 bytes |
| コンパイル時間 | 2,698 ms |
| コンパイル使用メモリ | 211,760 KB |
| 最終ジャッジ日時 | 2025-02-21 05:00:11 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 WA * 5 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using mint=modint998244353;
int main(){
int n;cin>>n;
vector<long long> a(n);
for(int i=0;i<n;i++)cin>>a[i];
vector<pair<string,long long>> srt(n);
for(int i=0;i<n;i++){
srt[i]={to_string(a[i]),a[i]};
while(srt[i].first.length()<18)srt[i].first=srt[i].first+to_string(a[i]);
srt[i].first=srt[i].first.substr(0,18);
}
sort(srt.begin(),srt.end());
mint ans=0;
vector<mint> pw(20);
pw[0]=1;
for(int i=0;i<19;i++)pw[i+1]=pw[i]*10;
for(int i=0;i<n;i++){
ans*=pw[to_string(srt[i].second).length()];
ans+=srt[i].second;
}
cout<<ans.val()<<"\n";
}
cled0328