結果
| 問題 | No.2098 [Cherry Alpha *] Introduction |
| コンテスト | |
| ユーザー |
miscalc
|
| 提出日時 | 2026-11-25 05:10:36 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 637µs | |
| コード長 | 15,914 bytes |
| 記録 | |
| コンパイル時間 | 2,862 ms |
| コンパイル使用メモリ | 357,760 KB |
| 実行使用メモリ | 7,860 KB |
| 最終ジャッジ日時 | 2026-11-25 05:10:41 |
| 合計ジャッジ時間 | 4,484 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 |
ソースコード
// https://github.com/miscalculation53/library
#define SINGLE_TESTCASE
// #define MULTI_TESTCASE
// #define AOJ_TESTCASE
#ifndef LOCAL
#define FAST_IO
// #define FAST_CIO
// #define INTERACTIVE
#endif
#define INF 4'000'000'000'000'000'037LL
#define EPS 1e-11
#line 30
#include <bits/stdc++.h>
using namespace std;
#if __cplusplus > 202002L && defined(__STDCPP_FLOAT128_T__)
#include <stdfloat>
#elif defined(__SIZEOF_FLOAT128__)
#else
#error "f128 requires a compiler with IEEE binary128 support, such as GCC on x86_64."
#endif
#define LIBRARY_HAS_FLOAT128 1
#include <cassert>
using namespace std;
using ll = long long;
using uint = unsigned int;
using pll = pair<ll, ll>;
#define vc vector
template <class T>
using vvc = vc<vc<T>>;
#line 80
using i128 = __int128_t;
using u128 = __uint128_t;
#define cauto const auto
#line 103
//! https://gcc.gnu.org/onlinedocs/libquadmath/Math-Library-Routines.html
#line 289
i128 stoi128(const string &s)
{
const bool neg = s.front() == '-';
u128 res = 0;
for (size_t i = size_t(neg); i < s.size(); i++)
res = 10 * res + unsigned(s[i] - '0');
if (neg)
return -i128(res - 1) - 1;
return i128(res);
}
inline string u128tos(u128 x)
{
string res;
do
{
res += char('0' + x % 10);
x /= 10;
} while (x > 0);
reverse(res.begin(), res.end());
return res;
}
string i128tos(i128 x)
{
return x < 0 ? "-" + u128tos(u128(-(x + 1)) + 1) : u128tos(u128(x));
}
istream &operator>>(istream &is, i128 &a)
{
string s;
if (!(is >> s)) return is;
a = stoi128(s);
return is;
}
ostream &operator<<(ostream &os, const i128 &a)
{
os << i128tos(a);
return os;
}
#line 337
#define overload4(_1, _2, _3, _4, name, ...) name
#define LIBRARY_REPEAT_LOOP(T, i, l, r, d) \
for (auto [i, library_repeat_end, library_repeat_step] = array<T, 3>{T(l), T(r), T(d)}; \
library_repeat_step > 0 ? i < library_repeat_end : i > library_repeat_end; \
i += library_repeat_step)
#define rep1(i, n) LIBRARY_REPEAT_LOOP(ll, i, 0, n, 1)
#define rep2(i, l, r) LIBRARY_REPEAT_LOOP(ll, i, l, r, 1)
#define rep3(i, l, r, d) LIBRARY_REPEAT_LOOP(ll, i, l, r, d)
#define rep(...) overload4(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__)
#define repi1(i, n) LIBRARY_REPEAT_LOOP(int, i, 0, n, 1)
#define repi2(i, l, r) LIBRARY_REPEAT_LOOP(int, i, l, r, 1)
#define repi3(i, l, r, d) LIBRARY_REPEAT_LOOP(int, i, l, r, d)
#define repi(...) overload4(__VA_ARGS__, repi3, repi2, repi1)(__VA_ARGS__)
#define fe(...) for (auto __VA_ARGS__)
#define fec(...) for (cauto &__VA_ARGS__)
#define fem(...) for (auto &__VA_ARGS__)
#line 408
template <class T, class U, class P>
constexpr pair<T, U> &operator+=(pair<T, U> &a, const P &b)
{
a.first += b.first;
a.second += b.second;
return a;
}
template <class T, class U, class P>
constexpr pair<T, U> operator+(pair<T, U> a, const P &b) { return a += b; }
template <class T, class U, class P>
constexpr pair<T, U> &operator-=(pair<T, U> &a, const P &b)
;
template <class T, class U, class P>
constexpr pair<T, U> operator-(pair<T, U> a, const P &b) { return a -= b; }
template <class T, class U>
constexpr pair<T, U> operator-(pair<T, U> a)
{
a.first = -a.first;
a.second = -a.second;
return a;
}
template <class T, size_t n, class A>
constexpr array<T, n> &operator+=(array<T, n> &a, const A &b)
{
for (size_t i = 0; i < n; i++)
a[i] += b[i];
return a;
}
template <class T, size_t n, class A>
constexpr array<T, n> operator+(array<T, n> a, const A &b) { return a += b; }
template <class T, size_t n, class A>
constexpr array<T, n> &operator-=(array<T, n> &a, const A &b)
;
template <class T, size_t n, class A>
constexpr array<T, n> operator-(array<T, n> a, const A &b) { return a -= b; }
template <class T, size_t n>
constexpr array<T, n> operator-(array<T, n> a)
{
for (auto &ai : a)
ai = -ai;
return a;
}
namespace internal
{
template <size_t... I, class A, class B>
constexpr auto &tuple_add_impl(A &a, const B &b, const index_sequence<I...>)
;
template <size_t... I, class A>
constexpr auto &tuple_neg_impl(A &a, const index_sequence<I...>)
;
};
template <class... Ts, class Tp>
constexpr tuple<Ts...> &operator+=(tuple<Ts...> &a, const Tp &b)
{ return internal::tuple_add_impl(a, b, make_index_sequence<tuple_size_v<tuple<Ts...>>>{}); }
template <class... Ts, class Tp>
constexpr tuple<Ts...> operator+(tuple<Ts...> a, const Tp &b) { return a += b; }
template <class... Ts, class Tp>
constexpr tuple<Ts...> &operator-=(tuple<Ts...> &a, const Tp &b)
;
template <class... Ts, class Tp>
constexpr tuple<Ts...> operator-(tuple<Ts...> a, const Tp &b) { return a -= b; }
template <class... Ts>
constexpr tuple<Ts...> operator-(tuple<Ts...> a)
{
internal::tuple_neg_impl(a, make_index_sequence<sizeof...(Ts)>{});
return a;
}
#line 512
template <class T>
constexpr bool is_integral_ext = is_integral_v<T> || is_same_v<T, i128> || is_same_v<T, u128>;
template <class T>
constexpr bool is_signed_ext = is_signed_v<T> || is_same_v<T, i128>;
template <class T>
constexpr bool is_unsigned_ext = is_unsigned_v<T> || is_same_v<T, u128>;
#line 628
namespace default_infty_detail
{
#line 660
}
#line 704
namespace template_math_detail
{
#line 728
}
#line 892
//! https://misawa.github.io/others/avoid_errors/techniques_to_avoid_errors.html
#line 963
#define ALL(a) (a).begin(), (a).end()
#define eb emplace_back
#define LMD(x, fx) ([&](const auto &x) { return fx; })
template <class F>
auto gen_vec(int n, const F &f)
;
#define GEN_VEC(n, i, fi) (gen_vec(n, LMD(i, fi)))
namespace template_vector_detail
{
#line 1019
}
#line 1170
namespace internal
{
}
namespace internal_monoid_power
{
#line 1206
}
#line 1504
constexpr array<pll, 4> DRULgrid = {{{1, 0}, {0, 1}, {-1, 0}, {0, -1}}};
constexpr array<pll, 4> DRULplane = {{{0, -1}, {1, 0}, {0, 1}, {-1, 0}}};
#line 1576
#define DEFAULT_COMP ranges::less
#line 1678
namespace internal
{
};
#line 1912
#define CPP_DUMP_DEFINE_DATA(...)
#define dump(...) ((void)0)
#define local(...)
#define oj(...) __VA_ARGS__
#define local_oj(a, b) (b)
#line 1977
namespace fastio
{
constexpr uint32_t SIZ = 1 << 17;
inline char ibuf[SIZ + 1], obuf[SIZ];
inline uint32_t pil = 0, pir = 0, por = 0;
__attribute__((noinline)) inline void load()
{
const uint32_t remaining = pir - pil;
if (remaining && pil) memmove(ibuf, ibuf + pil, remaining);
pil = 0;
pir = remaining + uint32_t(fread(ibuf + remaining, 1, SIZ - remaining, stdin));
ibuf[pir] = '\x7f';
}
inline bool ascii_space(unsigned char c)
{
return c == ' ' || unsigned(c - '\t') < 5;
}
inline void find_token()
{
for (;;)
{
const char *p = ibuf + pil;
const char *end = ibuf + pir;
while (ascii_space(*p)) ++p;
pil = uint32_t(p - ibuf);
if (p != end) return;
load();
if (!pir) abort();
}
}
__attribute__((noinline)) inline void flush()
{
size_t written = 0;
while (written < por)
{
const size_t n = fwrite(obuf + written, 1, por - written, stdout);
if (!n) abort();
written += n;
}
por = 0;
}
inline void append_bytes(const char *data, size_t size)
{
while (size)
{
const size_t n = min(size, size_t(SIZ - por));
memcpy(obuf + por, data, n);
por += uint32_t(n);
data += n;
size -= n;
if (por == SIZ) flush();
}
}
inline void append_char(char c)
{
if (por == SIZ) flush();
obuf[por++] = c;
}
#line 2056
inline constexpr uint powers_of_ten[8] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000};
template <class U>
__attribute__((always_inline)) inline void read_wide_integer_tail(
U &value, const char *&p, uint64_t columns, uint64_t stop)
;
#line 2078
template <class T>
__attribute__((always_inline)) inline void rd1_integer(T &x)
;
#line 2172
template <class T, enable_if_t<numeric_limits<T>::is_integer, int> = 0>
__attribute__((always_inline)) inline void rd1(T &x) ;
inline void rd1(char &x)
;
inline void rd1(string &x)
{
find_token();
x.clear();
for (;;)
{
const char *p = ibuf + pil;
const char *end = ibuf + pir;
const char *first = p;
while (p != end && !ascii_space(*p)) ++p;
x.append(first, size_t(p - first));
pil = uint32_t(p - ibuf);
if (p != end) return;
load();
if (!pir) return;
}
}
#line 2215
inline void rd1(float &x) ;
inline void rd1(double &x) ;
inline void rd1(long double &x) ;
template <class A, class B> void rd1(pair<A, B> &x);
template <class... T> void rd1(tuple<T...> &x);
template <class T, size_t N> void rd1(array<T, N> &x);
template <class T> void rd1(vc<T> &x);
template <class A, class B>
void rd1(pair<A, B> &x) ;
template <class... T>
void rd1(tuple<T...> &x)
;
template <class T, size_t N>
void rd1(array<T, N> &x)
;
template <class T>
void rd1(vc<T> &x)
;
inline constexpr auto decimal_triplets = []
{
array<array<char, 3>, 1000> result{};
for (unsigned i = 0; i < 1000; ++i)
{
result[i][0] = char('0' + i / 100);
result[i][1] = char('0' + i / 10 % 10);
result[i][2] = char('0' + i % 10);
}
return result;
}();
#line 2363
template <class U, bool newline>
__attribute__((always_inline)) inline void write_wide_integer(U magnitude, bool negative)
;
#line 2386
template <class T, bool newline = false>
__attribute__((always_inline)) inline void wt1_integer(T x)
;
#line 2412
template <class T, enable_if_t<numeric_limits<T>::is_integer, int> = 0>
__attribute__((always_inline)) inline void wt1(T x) ;
inline void wt1(char x) ;
inline void wt1(const char *x) ;
inline void wt1(string_view x) ;
inline void wt1(const string &x) { append_bytes(x.data(), x.size()); }
inline void wt1(float x) ;
inline void wt1(double x) ;
inline void wt1(long double x) ;
template <class A, class B> void wt1(const pair<A, B> &x);
template <class... T> void wt1(const tuple<T...> &x);
template <class T, size_t N> void wt1(const array<T, N> &x);
template <class T> void wt1(const vc<T> &x);
template <class A, class B>
void wt1(const pair<A, B> &x) ;
template <class... T>
void wt1(const tuple<T...> &x)
;
template <class T, size_t N>
void wt1(const array<T, N> &x)
;
template <class T>
void wt1(const vc<T> &x)
;
template <class... T>
void read(T &...x) { (rd1(x), ...); }
template <class... T>
void write(T &&...x) { (wt1(forward<T>(x)), ...); }
template <class... T>
void print(T &&...x)
{
if constexpr (sizeof...(T) == 1 &&
((is_integral_v<decay_t<T>> && !is_same_v<decay_t<T>, char>) && ...))
(wt1_integer<decay_t<T>, true>(forward<T>(x)), ...);
else
{
size_t index = 0;
((index++ ? void(append_char(' ')) : void(), wt1(forward<T>(x))), ...);
append_char('\n');
}
}
}
struct Dummy {
Dummy() { atexit(fastio::flush); }
} dummy;
//! https://trap.jp/post/1224/
#line 2532
namespace internal
{
template <class... Ts>
void READnodump(Ts &...a) { fastio::read(a...); }
template <class... T>
void READVECnodump(int n, vc<T> &...v)
;
template <class... T>
void READVEC2nodump(int n, int m, vvc<T> &...v)
;
template <class... T>
void READJAGnodump(int n, vvc<T> &...vs)
;
#line 2579
};
#define READ(...) internal::READnodump(__VA_ARGS__); dump(__VA_ARGS__)
#define LIBRARY_INOUT_TYPE(...) LIBRARY_INOUT_TYPE_IMPL(__VA_ARGS__)(__VA_ARGS__)
#define LIBRARY_INOUT_TYPE_IMPL(T, ...) LIBRARY_INOUT_TYPE_SELECT(LIBRARY_INOUT_TYPE_PROBE T, LIBRARY_INOUT_TYPE_KEEP)
#define LIBRARY_INOUT_TYPE_PROBE(...) _, LIBRARY_INOUT_TYPE_REMOVE
#define LIBRARY_INOUT_TYPE_SELECT(...) LIBRARY_INOUT_TYPE_SECOND(__VA_ARGS__)
#define LIBRARY_INOUT_TYPE_SECOND(_0, _1, ...) _1
#define LIBRARY_INOUT_TYPE_KEEP(...) __VA_ARGS__
#define LIBRARY_INOUT_TYPE_REMOVE(T) LIBRARY_INOUT_TYPE_KEEP T
#define IN(T, ...) LIBRARY_INOUT_TYPE(T) __VA_ARGS__; READ(__VA_ARGS__)
#define CHAR(...) IN(char, __VA_ARGS__)
#define INT(...) IN(int, __VA_ARGS__)
#define LL(...) IN(ll, __VA_ARGS__)
#define STR(...) IN(string, __VA_ARGS__)
#define ARR(T, n, ...) array<LIBRARY_INOUT_TYPE(T), n> __VA_ARGS__; READ(__VA_ARGS__)
#define READVEC(...) internal::READVECnodump(__VA_ARGS__); dump(__VA_ARGS__)
#define READVEC2(...) internal::READVEC2nodump(__VA_ARGS__); dump(__VA_ARGS__)
#define VEC(T, n, ...) vc<LIBRARY_INOUT_TYPE(T)> __VA_ARGS__; READVEC(n, __VA_ARGS__)
#define VEC2(T, n, m, ...) vvc<LIBRARY_INOUT_TYPE(T)> __VA_ARGS__; READVEC2(n, m, __VA_ARGS__)
#define READJAG(...) internal::READJAGnodump(__VA_ARGS__); dump(__VA_ARGS__)
#define JAG(T, n, ...) vvc<LIBRARY_INOUT_TYPE(T)> __VA_ARGS__; READJAG(n, __VA_ARGS__)
#define ENDL '\n'
#line 2688
#define WRITE fastio::write
#define PRINT fastio::print
#define PRINTEXIT(...) do { PRINT(__VA_ARGS__); exit(0); } while (false)
#define PRINTRETURN(...) do { PRINT(__VA_ARGS__); return; } while (false)
template <class T>
void PRINTV(const vc<T> &v) ;
#define PRINTVEXIT(...) do { PRINTV(__VA_ARGS__); exit(0); } while (false)
#define PRINTVRETURN(...) do { PRINTV(__VA_ARGS__); return; } while (false)
template <class T, const size_t m>
array<vc<T>, m> unzip(const vc<array<T, m>> &vt)
;
#line 2737
template <class T, class U>
pair<vc<T>, vc<U>> unzip(const vc<pair<T, U>> &vt)
;
#line 2758
namespace internal
{
};
template <class... Ts>
auto unzip(const vc<tuple<Ts...>> &vt)
;
#line 2795
namespace internal
{
template <class... Ts>
auto zip_vectors(const vc<Ts> &...v)
;
};
#define UNZIP(vt, ...) auto [__VA_ARGS__] = unzip(vt)
#define ZIP(vt, ...) auto vt = internal::zip_vectors(__VA_ARGS__)
mt19937_64 mt;
#line 2853
namespace internal
{
#line 2888
};
#line 2917
/*!
* Portions corresponding to AtCoder Library (CC0-1.0): modular arithmetic operators.
* Upstream: atcoder/modint.hpp
* https://github.com/atcoder/ac-library/tree/864245a00b00dd008d1abfdc239618fdb7d139da
* License: https://github.com/atcoder/ac-library/blob/864245a00b00dd008d1abfdc239618fdb7d139da/LICENSE
*/
#line 2997
/*!
* Portions corresponding to AtCoder Library (CC0-1.0): primality testing.
* Upstream: atcoder/internal_math.hpp
* https://github.com/atcoder/ac-library/tree/864245a00b00dd008d1abfdc239618fdb7d139da
* License: https://github.com/atcoder/ac-library/blob/864245a00b00dd008d1abfdc239618fdb7d139da/LICENSE
*/
#line 3119
/*!
* Portions corresponding to AtCoder Library (CC0-1.0): Barrett reduction.
* Upstream: atcoder/internal_math.hpp
* https://github.com/atcoder/ac-library/tree/864245a00b00dd008d1abfdc239618fdb7d139da
* License: https://github.com/atcoder/ac-library/blob/864245a00b00dd008d1abfdc239618fdb7d139da/LICENSE
*/
#line 3199
//! https://www.mathenachia.blog/even-mod-montgomery-impl/
#line 3977
// using mint = modint1000000007;
// using mint = static_modint<1000000000>;
// using mint = modint;
void init()
{
oj(mt.seed(random_device()()));
}
void main2()
{
map<char, string> mp = {
{'Z', "1st"},
{'B', "2nd"},
{'S', "3rd"},
{'E', "4th"},
{'D', "Alpha"}
};
STR(S);
PRINT(mp[S.front()]);
}
void test()
{
}
template <auto init, auto main2, auto test>
struct Main
{
Main()
{
cauto CERR = [](string val, string color)
{
string s = "\033[" + color + "m" + val + "\033[m";
};
CERR("\n[FAST_IO]\n\n", "32");
cout << fixed << setprecision(20);
init();
#line 4049
CERR("\n[SINGLE_TESTCASE]\n\n", "36");
main2();
#line 4064
}
};
Main<init, main2, test> main_dummy;
int main() {}
// submit-code: hash=1ec1919ae3dc source=1ec1919ae3dc6782efd0fd66eabeadeac0e02be01f4dbbf084fbbebc3b799d45 input=de68b4219c672e107b051427829e18666b0ef0146477d111f303531aab3ef5d0 body=ba6e7baeb0001d94d55a70f9bbc95b28e6582f12e08347710d0265fe350df482
miscalc