#line 1 "paper.cpp" #include #line 2 "library2/utility/ceil_div.hpp" template constexpr T ceil_div(const T a, const T b) { return (a + b - 1) / b; } #line 3 "library2/utility/int_alias.hpp" using i8 = std::int8_t; using u8 = std::uint8_t; using i16 = std::int16_t; using i32 = std::int32_t; using i64 = std::int64_t; using u16 = std::uint16_t; using u32 = std::uint32_t; using u64 = std::uint64_t; #line 3 "library2/utility/rep.hpp" class Range { struct Iterator { int itr; constexpr Iterator(const int pos) noexcept : itr(pos) {} constexpr void operator++() noexcept { ++itr; } constexpr bool operator!=(const Iterator &other) const noexcept { return itr != other.itr; } constexpr int operator*() const noexcept { return itr; } }; const Iterator first, last; public: explicit constexpr Range(const int f, const int l) noexcept : first(f), last(std::max(f, l)) {} constexpr Iterator begin() const noexcept { return first; } constexpr Iterator end() const noexcept { return last; } }; constexpr Range rep(const int l, const int r) noexcept { return Range(l, r); } constexpr Range rep(const int n) noexcept { return Range(0, n); } #line 3 "library2/utility/scan.hpp" template T scan() { T ret; std::cin >> ret; return ret; } #line 7 "paper.cpp" int main() { const int N = scan(); std::vector A(N); for (auto &e : A) { e = scan(); } std::multiset S; for (const auto e : A) { S.insert(e); } // エスパー... for (const int i : rep(N - 1)) { if (i & 1) { S.insert(ceil_div(*++S.rbegin(), *S.rbegin())); S.erase(--S.end()); S.erase(--S.end()); } else { S.insert(*S.begin() * *++S.begin()); S.erase(S.begin()); S.erase(S.begin()); } } std::cout << *S.begin() << std::endl; }