chore(cpp): don't use namespaces in skeleton

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2023-07-29 15:57:32 +02:00
parent 42315a22b8
commit 17e43f0ebf
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -20,15 +20,9 @@
#include <string> #include <string>
#include <vector> #include <vector>
template <typename T, typename U> #pragma region helpers
std::ostream &operator<<(std::ostream &s, std::pair<T, U> const &p) {
return s << p.first << " " << p.second;
}
namespace helpers {
namespace math {
#pragma region math
static constexpr std::int32_t MODULO = 1000000007; static constexpr std::int32_t MODULO = 1000000007;
long pow(long base, long exp) { long pow(long base, long exp) {
@ -37,11 +31,25 @@ long pow(long base, long exp) {
if (exp % 2 == 0) return half * half; if (exp % 2 == 0) return half * half;
return half * half * base; return half * half * base;
} }
#pragma endregion /* math */
} // namespace math #pragma region output
template <typename T, typename U>
std::ostream &operator<<(std::ostream &os, std::pair<T, U> const &p) {
return os << p.first << " " << p.second;
}
namespace input {
template <typename T>
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 <typename T> template <typename T>
std::vector<T> load_vector(std::size_t size) { std::vector<T> load_vector(std::size_t size) {
std::vector<T> result{}; std::vector<T> result{};
@ -54,31 +62,12 @@ std::vector<T> load_vector(std::size_t size) {
return result; return result;
} }
#pragma endregion /* input */
} // namespace input
namespace output {
template <typename T>
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) #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 // for N test cases, uncomment for single test case
// #define SINGLE // #define SINGLE
@ -86,7 +75,6 @@ using namespace output;
namespace solution { namespace solution {
using namespace std; using namespace std;
using namespace helpers;
void solve() { void solve() {
// TODO // TODO