結果
問題 | No.2729 Addition and Multiplication in yukicoder (Easy) |
ユーザー | 唐揚げが壊わ |
提出日時 | 2024-04-19 21:27:29 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 153 ms / 2,000 ms |
コード長 | 8,701 bytes |
コンパイル時間 | 2,382 ms |
コンパイル使用メモリ | 216,852 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 13:59:07 |
合計ジャッジ時間 | 5,282 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 144 ms
5,248 KB |
testcase_03 | AC | 76 ms
5,248 KB |
testcase_04 | AC | 82 ms
5,248 KB |
testcase_05 | AC | 87 ms
5,248 KB |
testcase_06 | AC | 150 ms
5,248 KB |
testcase_07 | AC | 106 ms
5,248 KB |
testcase_08 | AC | 142 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | AC | 1 ms
5,248 KB |
testcase_11 | AC | 2 ms
5,248 KB |
testcase_12 | AC | 153 ms
5,248 KB |
testcase_13 | AC | 149 ms
5,248 KB |
testcase_14 | AC | 150 ms
5,248 KB |
testcase_15 | AC | 148 ms
5,248 KB |
testcase_16 | AC | 103 ms
5,248 KB |
testcase_17 | AC | 104 ms
5,248 KB |
testcase_18 | AC | 128 ms
5,248 KB |
testcase_19 | AC | 102 ms
5,248 KB |
ソースコード
#include <bits/stdc++.h> // #include <atcoder/all> // Ctrl + end using namespace std; using str = string; using vs = vector<string>; using ll = long long; using ld = long double; using vll = vector<long long>; using vvll = vector<vector<long long>>; using vvvll = vector<vector<vector<long long>>>; using vvvvll = vector<vector<vector<vector<long long>>>>; using vb = vector<bool>; using vvb = vector<vector<bool>>; using pll = pair<ll, ll>; using vpll = vector<pair<ll, ll>>; #define REP1(i, n) for (long long i = 0; i < n; i++) #define REP2(i, n, m) for (long long i = n; i < m; i++) #define REP3(i, n, d, m) \ for (long long i = n; (n < m) ? (i < m) : (i > m); i += d) #define OVERLOAD_REP(a, b, c, d, e, ...) e #define REP(...) OVERLOAD_REP(__VA_ARGS__, REP3, REP2, REP1)(__VA_ARGS__) #define REPv(itr, v) for (auto itr = v.begin(); itr != v.end(); itr++) #define REPIN(itr, v) \ for (auto itr = v.begin(); itr != v.end(); itr++) { \ cin >> *itr; \ } #define been(vec) vec.begin(), vec.end() #define LIN \ = []() { \ long long LONGLONG_INPUT; \ cin >> LONGLONG_INPUT; \ return LONGLONG_INPUT; \ }() #define SIN \ = []() { \ string STRING_INPUT; \ cin >> STRING_INPUT; \ return STRING_INPUT; \ }() #define SPNL(i, SIZE) (i + 1 == SIZE ? '\n' : ' ') template <class T> constexpr T gcd(const T &x, const T &y) { return (x % y) ? gcd(y, x % y) : y; } template <class T, class... R> constexpr T gcd(const T &x, const R &...y) { return gcd(x, gcd(y...)); } template <class T> constexpr T lcm(const T &x, const T &y) { return x / gcd(x, y) * y; } template <class T, class... R> constexpr T lcm(const T &x, const R &...y) { return lcm(x, lcm(y...)); } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } // 3要素で比較するとfunc(a,b,comp)と勘違いされるから「{...}」使う template <class... T> constexpr auto min(const T &...a) { return min(initializer_list<common_type_t<T...>>{a...}); } template <class... T> constexpr auto max(const T &...a) { return max(initializer_list<common_type_t<T...>>{a...}); } // tuple処理 template <size_t N = 0, class T, class F> void iterate_tuple(T &t, const F &func) { if constexpr (N < tuple_size_v<T>) { auto &x = get<N>(t); func(x); iterate_tuple<N + 1>(t, func); } } // ストリーム演算子 入力 template <class T1, class T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; } template <class... T> istream &operator>>(istream &is, tuple<T...> &t) { auto func = [&is](auto &t) { is >> t; }; iterate_tuple(t, func); return is; } template <class T> istream &operator>>(istream &is, vector<T> &v) { for (size_t i = 0, n = v.size(); i < n; i++) { is >> v[i]; } return is; } // ストリーム演算子 出力 template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << p.first << " " << p.second << " "; return os; } template <class... T> ostream &operator<<(ostream &os, const tuple<T...> &t) { auto func = [&os](auto t) { os << t << " "; }; iterate_tuple(t, func); return os; } template <class T> ostream &operator<<(ostream &os, const vector<T> &v) { for (size_t i = 0, n = v.size(); i < n; i++) { os << v[i] << " "; } return os; } template <class T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { for (size_t i = 0, n = v.size(); i < n; i++) { os << v[i] << endl; } return os; } template <class T1, class T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp) { for (auto itr = mp.begin(); itr != mp.end(); itr++) { os << "[" << itr->first << "]" << itr->second << endl; } return os; } template <class T1, class T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp) { for (auto itr = mp.begin(); itr != mp.end(); itr++) { os << "[" << itr->first << "]" << itr->second << endl; } return os; } template <class T> void input(T &a) { cin >> a; } template <class T, class... R> void input(T &a, R &...b) { input(a), input(b...); } template <class... T> constexpr void output(const T &...a) { (cout << ... << (cout << a, " ")); cout << endl; } template <class T1, class T2> pair<T1, T2> operator+(const pair<T1, T2> &a, const pair<T1, T2> &b) { pair<T1, T2> ret; ret = make_pair(a.first + b.first, a.second + b.second); return ret; } template <class T1, class T2, class T3> pair<T1, T2> operator+(const pair<T1, T2> &a, const T3 &b) { pair<T1, T2> ret; ret = make_pair(a.first + b, a.second + b); return ret; } template <class T1, class T2> pair<T1, T2> operator-(const pair<T1, T2> &a, const pair<T1, T2> &b) { pair<T1, T2> ret; ret = make_pair(a.first - b.first, a.second - b.second); return ret; } template <class T1, class T2, class T3> pair<T1, T2> operator-(const pair<T1, T2> &a, const T3 &b) { pair<T1, T2> ret; ret = make_pair(a.first - b, a.second - b); return ret; } template <class T> vector<T> operator+(const vector<T> &a, const vector<T> &b) { // aとbのサイズは一致する必要がある。 assert(a.size() == b.size()); vector<T> ret = a; for (size_t i = 0; i < ret.size(); i++) { ret[i] = a[i] + b[i]; } return ret; } template <class T1, class T2> vector<T1> operator+(const vector<T1> &a, const T2 &b) { vector<T1> ret = a; for (size_t i = 0; i < ret.size(); i++) { ret[i] = a[i] + b; } return ret; } // 二次元配列aを右回転する template <class T> constexpr vector<vector<T>> rotate_90deg(const vector<vector<T>> &a) { vector<vector<T>> b(a.front().size(), vector<T>(a.size())); for (size_t i = 0; i < a.front().size(); i++) { for (size_t j = 0; j < a.size(); j++) { b[i][j] = (a[a.size() - 1 - j][i]); } } return b; } // 二次元配列aをelementで指定した要素を含み切るようにクリッピング vector<string> clip_vec2(const vector<string> &a, const char element) { ll left = LLONG_MAX, right = -1, top = LLONG_MAX, bottom = -1; for (size_t i = 0; i < a.size(); i++) { for (size_t j = 0; j < a.front().size(); j++) { if (a[i][j] == element) { chmin(top, (ll)i); chmax(bottom, (ll)i); chmin(left, (ll)j); chmax(right, (ll)j); } } } vector<string> b(abs(bottom - top), string(abs(right - left), ' ')); for (size_t i = 0; i < b.size(); i++) { for (size_t j = 0; j < b.front().size(); j++) { b[i][j] = a[i + top][j + left]; } } return b; } template <class T> constexpr vector<vector<T>> clip_vec2(const vector<vector<T>> &a, const T element) { ll left = LLONG_MAX, right = -1, top = LLONG_MAX, bottom = -1; for (size_t i = 0; i < a.size(); i++) { for (size_t j = 0; j < a.front().size(); j++) { if (a[i][j] == element) { chmin(top, (ll)i); chmax(bottom, (ll)i); chmin(left, (ll)j); chmax(right, (ll)j); } } } vector<vector<T>> b(abs(bottom - top), vector<T>(abs(right - left))); for (size_t i = 0; i < b.size(); i++) { for (size_t j = 0; j < b.front().size(); j++) { b[i][j] = a[i + top][j + left]; } } return b; } // 二次元配列aをelementで指定した要素で囲い込む vector<string> envelope_vec2(const vector<string> &a, const char element) { vector<string> b = a; for (size_t i = 0; i < b.size(); i++) { b[i].insert(b[i].end(), {element, element}); std::rotate(b[i].rbegin(), b[i].rbegin() + 1, b[i].rend()); } b.push_back(string(b[0].size(), element)); b.push_back(b.back()); std::rotate(b.rbegin(), b.rbegin() + 1, b.rend()); return b; } template <class T> constexpr vector<vector<T>> envelope_vec2(const vector<vector<T>> &a, const T element) { vector<vector<T>> b = a; for (size_t i = 0; i < b.size(); i++) { b[i].insert(b[i].end(), {element, element}); std::rotate(b[i].rbegin(), b[i].rbegin() + 1, b[i].rend()); } b.push_back(vector<T>(b[0].size(), element)); b.push_back(b.back()); std::rotate(b.rbegin(), b.rbegin() + 1, b.rend()); return b; } const long long mod1000 = 1000000007; const long long mod998 = 998244353; const string yes = "Yes"; const string no = "No"; int main() { ll n LIN; vll a(n); input(a); sort(been(a)); ll ans = 0; REP(i, n) { ((ans *= 10) += a[i]) %= mod998; } cout << ans << endl; }