結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
コンテスト
ユーザー hint908
提出日時 2024-04-19 21:52:35
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.90.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,419 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,407 ms
コンパイル使用メモリ 197,204 KB
最終ジャッジ日時 2026-07-04 12:54:05
合計ジャッジ時間 3,250 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
In file included from /usr/include/x86_64-linux-gnu/c++/12/bits/c++allocator.h:33,
                 from /usr/include/c++/12/bits/allocator.h:46,
                 from /usr/include/c++/12/string:41,
                 from /usr/include/c++/12/bits/locale_classes.h:40,
                 from /usr/include/c++/12/bits/ios_base.h:41,
                 from /usr/include/c++/12/ios:42,
                 from /usr/include/c++/12/istream:38,
                 from /usr/include/c++/12/sstream:38,
                 from /usr/include/c++/12/complex:45,
                 from /usr/include/c++/12/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:54,
                 from main.cpp:1:
/usr/include/c++/12/bits/new_allocator.h: In instantiation of ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = S; _Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&}; _Tp = S]’:
/usr/include/c++/12/bits/alloc_traits.h:516:17:   required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = S; _Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&}; _Tp = S; allocator_type = std::allocator<S>]’
/usr/include/c++/12/bits/vector.tcc:117:30:   required from ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&}; _Tp = S; _Alloc = std::allocator<S>; reference = S&]’
main.cpp:47:9:   required from here
/usr/include/c++/12/bits/new_allocator.h:186:11: error: no matching function for call to ‘S::S(std::__cxx11::basic_string<char>&)’
  186 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:28:8: note: candidate: ‘S::S()’
   28 | struct S{
      |        ^
main.cpp:28:8:

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T> using VVVV = VV<VV<T>>;
#define rep(i,n) for(ll i=0ll;i<n;i++)
#define REP(i,a,n) for(ll i=a;i<n;i++)
const long long INF = (1LL << 60);
const long long mod99 = 998244353;
const long long mod107 = 1000000007;
const long long mod = mod99;
#define eb emplace_back
#define pb eb
#define be(v) (v).begin(),(v).end()
#define all(i,v) for(auto& i : v)
#define all2(i,j,v) for(auto& [i,j] : v)
template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

// cin.tie(nullptr);
// ios::sync_with_stdio(false);
// cout << fixed << setprecision(20);

struct S{
  string s;
  bool operator<(const S&v){
    string x = s+v.s;
    string y = v.s+s;
    if(x<y) return 1;
    else if(x>y) return 0;
    else if(s.size()<v.s.size()) return 1;
    return 0;
  }
};

void solve(){
  ll n;
  cin >> n;
  V<S> v;
  rep(i, n){
    string s;
    cin >> s;
    v.eb(s);
  }
  sort(be(v));
  ll x = 0;
  all(i,v) all(c,i.s) x = (x*10+c-'0')%mod99;
  cout << x << endl;
}





int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int t=1;
  // cin >> t;
  rep(i,t) solve();
}
0