From 17e43f0ebf35ee9bec64f889dea844c957fc6440 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sat, 29 Jul 2023 15:57:32 +0200 Subject: [PATCH] chore(cpp): don't use namespaces in skeleton Signed-off-by: Matej Focko --- .common/cpp/skeleton.cpp | 52 ++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/.common/cpp/skeleton.cpp b/.common/cpp/skeleton.cpp index 0f0ed86..0e0fc71 100644 --- a/.common/cpp/skeleton.cpp +++ b/.common/cpp/skeleton.cpp @@ -20,15 +20,9 @@ #include #include -template -std::ostream &operator<<(std::ostream &s, std::pair const &p) { - return s << p.first << " " << p.second; -} - -namespace helpers { - -namespace math { +#pragma region helpers +#pragma region math static constexpr std::int32_t MODULO = 1000000007; long pow(long base, long exp) { @@ -37,11 +31,25 @@ long pow(long base, long exp) { if (exp % 2 == 0) return half * half; return half * half * base; } +#pragma endregion /* math */ -} // namespace math +#pragma region output +template +std::ostream &operator<<(std::ostream &os, std::pair const &p) { + return os << p.first << " " << p.second; +} -namespace input { +template +inline void answer(const T &ans) { + std::cout << ans << "\n"; +} + +inline void yes() { std::cout << "YES\n"; } +inline void no() { std::cout << "NO\n"; } +inline void yesno(bool ans) { std::cout << (ans ? "YES" : "NO") << "\n"; } + +#pragma region input template std::vector load_vector(std::size_t size) { std::vector result{}; @@ -54,31 +62,12 @@ std::vector load_vector(std::size_t size) { return result; } +#pragma endregion /* input */ -} // namespace input - -namespace output { - -template -inline void answer(const T &ans) { - std::cout << ans << "\n"; -} - -inline void yes() { std::cout << "YES\n"; } -inline void no() { std::cout << "NO\n"; } -inline void yesno(bool ans) { std::cout << (ans ? "YES" : "NO") << "\n"; } - -} // namespace output - -using namespace std; - -using namespace math; -using namespace input; -using namespace output; #define LOOP(var, n) for (auto var = 0; var < n; ++var) -} // namespace helpers +#pragma endregion /* helpers */ // for ‹N› test cases, uncomment for single test case // #define SINGLE @@ -86,7 +75,6 @@ using namespace output; namespace solution { using namespace std; -using namespace helpers; void solve() { // TODO