結果
問題 |
No.164 ちっちゃくないよ!!
|
ユーザー |
![]() |
提出日時 | 2020-10-03 01:31:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 6,635 bytes |
コンパイル時間 | 2,317 ms |
コンパイル使用メモリ | 180,392 KB |
最終ジャッジ日時 | 2025-03-14 08:17:01 |
合計ジャッジ時間 | 3,011 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
In file included from /usr/include/c++/13/string:43, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from main.cpp:4: /usr/include/c++/13/bits/allocator.h: In destructor ‘std::__cxx11::basic_string<char>::_Alloc_hider::~_Alloc_hider()’: /usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = char]’: target specific option mismatch 184 | ~allocator() _GLIBCXX_NOTHROW { } | ^ In file included from /usr/include/c++/13/string:54: /usr/include/c++/13/bits/basic_string.h:181:14: note: called from here 181 | struct _Alloc_hider : allocator_type // TODO check __is_final | ^~~~~~~~~~~~
ソースコード
#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include "bits/stdc++.h" #ifdef _MSC_VER #include <intrin.h> //gcc上ではこれがあると動かない。__popcnt, umul128 等用のincludeファイル。 #define __builtin_popcount __popcnt #define __builtin_popcountll __popcnt64 #pragma warning(disable : 4996) #pragma intrinsic(_umul128) #endif //#include <atcoder/all> //using namespace atcoder; //#include <boost/multiprecision/cpp_int.hpp> //#include <boost/multiprecision/cpp_dec_float.hpp> using namespace std; typedef long long ll; typedef long double ld; #define int long long #define double long double #define LL128 boost::multiprecision::int128_t #define LL boost::multiprecision::cpp_int #define LD100 boost::multiprecision::cpp_dec_float_100 #define rep(i, n) for(long long i = 0; i < (n); i++) #define sqrt(d) pow((ld) (d), 0.50) #define PII pair<int, int> #define MP make_pair #define PB push_back #define ALL(v) v.begin(), v.end() const int INF = std::numeric_limits<int>::max() / 2 - 100000000; const long long INF2 = std::numeric_limits<long long>::max() / 2 - 100000000; const ld pi = acos(-1); //constexpr int MOD = 1000000007; //1e9 + 7 //constexpr int MOD = 1000000009; //1e9 + 9 constexpr int MOD = 998244353; // 7 * 17 * 2^23 + 1 long long my_gcd(long long a, long long b) { if (b == 0) return a; return my_gcd(b, a % b); } // ax + by = gcd(a, b) を解く。返り値は、gcd(a, b)。 long long my_gcd_ext(long long a, long long b, long long& x, long long& y) { if (b == 0) { x = 1; y = 0; return a; } long long tempo = my_gcd_ext(b, a % b, y, x); //bx' + ry' = gcd(a, b) → (qb + r)x + by = gcd(a, b) に戻さないといけない。// (r = a % b) //b(x' - qy') + (bq + r)y' = gcd(a, b) と同値変形できるから、 // x = y', y = x' - qy' y -= (a / b) * x; return tempo; } //M を法として、a の逆元を返す。但し gcd(a, M) = 1。 long long my_invmod(long long a, long long M) { long long x = 0, y = 0; long long memo = my_gcd_ext(a, M, x, y); assert(memo == 1LL); x %= M; if (x < 0) x += M; return x; } //繰り返し2乗法 //N^aの、Mで割った余りを求める。 ll my_pow(ll N, ll a, ll M) { ll tempo; if (a == 0) { return 1; } else { if (a % 2 == 0) { tempo = my_pow(N, a / 2, M); return (tempo * tempo) % M; } else { tempo = my_pow(N, a - 1, M); return (tempo * N) % M; } } } ll my_pow(ll N, ll a) { ll tempo; if (a == 0) { return 1; } else { if (a % 2 == 0) { tempo = my_pow(N, a / 2); return (tempo * tempo); } else { tempo = my_pow(N, a - 1); return (tempo * N); } } } //N_C_a を M で割った余り ll my_combination(ll N, ll a, ll M) { if (N < a) return 0; ll answer = 1; rep(i, a) { answer *= (N - i); answer %= M; } rep(i, a) { answer *= my_pow(i + 1, M - 2, M); answer %= M; } return answer; } //N_C_i を M で割った余りを、v.at(i) に代入する。 void my_combination_table(ll N, ll M, vector<ll>& v) { v.assign(N + 1, 1); for (ll i = 1; i <= N; i++) { v.at(i) = v.at(i - 1) * (N - (i - 1LL)); v.at(i) %= M; v.at(i) *= my_invmod(i, M); v.at(i) %= M; } } //(N + i)_C_N を M で割った余りを、v.at(i) に代入する。(v のサイズに依存) void my_combination_table2(ll N, ll M, vector<ll>& v) { v.at(0) = 1; for (ll i = 1; i < (ll)v.size(); i++) { v.at(i) = v.at(i - 1) * (N + i); v.at(i) %= M; v.at(i) *= my_invmod(i, M); v.at(i) %= M; } } //階乗。x ! まで計算する。結果は dp に保存する。20 ! = 2.43e18 まで long long に入る。 ll factorial(ll x, vector<ll>& dp) { if ((ll)dp.size() <= x) { int n = dp.size(); rep(i, x + 1 - n) { dp.push_back(0); } } if (x == 0) return dp.at(x) = 1; if (dp.at(x) != -1 && dp.at(x) != 0) return dp.at(x); return dp.at(x) = x * factorial(x - 1, dp); } //階乗の M で割った余り。x ! まで計算する。結果は dp に保存する。 ll factorial2(ll x, ll M, vector<ll>& dp) { if ((ll)dp.size() <= x) { int n = dp.size(); rep(i, x + 1 - n) { dp.push_back(0); } } if (x == 0) return dp.at(x) = 1; if (dp.at(x) != -1 && dp.at(x) != 0) return dp.at(x); ll tempo = (x * factorial2(x - 1, M, dp)); tempo %= M; return dp.at(x) = tempo; } //階乗の mod M での逆元 (M: prime)。x ! まで計算する。結果は dp に保存する。 ll factorial_inverse(ll x, ll M, vector<ll>& dp) { if ((ll)dp.size() <= x) { int n = dp.size(); rep(i, x + 1 - n) { dp.push_back(0); } } if (x == 0) return dp.at(x) = 1; if (dp.at(x) != -1 && dp.at(x) != 0) return dp.at(x); return dp.at(x) = (my_pow(x, M - 2, M) * factorial_inverse(x - 1, M, dp)) % M; } //N_C_a を M で割った余り。何度も呼ぶ用。 ll my_combination2(ll N, ll a, ll M, vector<ll>& dp_factorial, vector<ll>& dp_factorial_inverse) { if ((ll)dp_factorial.size() <= N) { factorial2(N, M, dp_factorial); } if ((ll)dp_factorial_inverse.size() <= N) { factorial_inverse(N, M, dp_factorial_inverse); } if (N < a) return 0; ll answer = 1; answer *= dp_factorial.at(N); answer %= M; answer *= dp_factorial_inverse.at(N - a); answer %= M; answer *= dp_factorial_inverse.at(a); answer %= M; return answer; } // base を底としたときの、n の i桁目を、v.at(i) に入れる。(桁数は n に応じて自動で設定する。) void ll_to_vector(signed base, long long n, vector<signed>& v) { long long tempo = n; long long tempo2 = n; signed n_digit = 1; while (tempo2 >= base) { tempo2 /= base; n_digit++; } v.assign(n_digit, 0); // v のサイズを適切に調整する場合。 // n_digit = v.size(); // v のサイズをそのままにする場合。 for (signed i = 0; i < n_digit; i++) { long long denominator = my_pow(base, n_digit - 1 - i); v.at(i) = tempo / denominator; tempo -= v.at(i) * denominator; } } signed main() { int N; cin >> N; vector<int> base(N, 0); vector<string> V(N); rep(i, N) { cin >> V.at(i); rep(j, (int)V.at(i).size()) { if ('0' <= V.at(i).at(j) && V.at(i).at(j) <= '9') base.at(i) = max(base.at(i), (int)(V.at(i).at(j) - '0')); else base.at(i) = max(base.at(i), (int)(V.at(i).at(j) - 'A') + 10); } } vector<int> U(N, 0); rep(i, N) { rep(j, (int)V.at(i).size()) { U.at(i) *= base.at(i) + 1; if ('0' <= V.at(i).at(j) && V.at(i).at(j) <= '9') U.at(i) += (int)(V.at(i).at(j) - '0'); else U.at(i) += (int)(V.at(i).at(j) - 'A') + 10; } } sort(ALL(U)); cout << U.front() << endl; //rep(i, N) { //cout << U.at(i) << endl; //} }