mirror of
https://gitlab.com/mfocko/Codeforces.git
synced 2024-09-20 01:16:57 +02:00
Matej Focko
663472e5da
* add missing headers: ‹bit›, ‹map›, ‹queue› and ‹set› * name the namespaces * math * introduce ‹MODULO› for big numbers in problems * input * implement ‹load_vector› * output * implement ‹operator<<› for ‹std::pair› * implement ‹yesno› as shortcut for YES/NO answers * implement ‹LOOP(n)› for quick range-like for-loops * make ‹N› test cases the default Signed-off-by: Matej Focko <me@mfocko.xyz>
130 lines
1.9 KiB
C++
130 lines
1.9 KiB
C++
#include <algorithm>
|
||
#include <bit>
|
||
#include <cassert>
|
||
#include <cctype>
|
||
#include <cstdint>
|
||
#include <functional>
|
||
#include <iostream>
|
||
#include <map>
|
||
#include <optional>
|
||
#include <queue>
|
||
#include <set>
|
||
#include <sstream>
|
||
#include <string>
|
||
#include <vector>
|
||
|
||
template <typename T, typename U>
|
||
std::ostream &operator<<(std::ostream &s, std::pair<T, U> const &p) {
|
||
return s << p.first << " " << p.second;
|
||
}
|
||
|
||
namespace helpers {
|
||
|
||
using namespace std;
|
||
|
||
namespace math {
|
||
|
||
static constexpr int32_t MODULO = 1000000007;
|
||
|
||
long pow(long base, long exp) {
|
||
if (exp == 0) return 1;
|
||
long half = pow(base, exp / 2);
|
||
if (exp % 2 == 0) return half * half;
|
||
return half * half * base;
|
||
}
|
||
|
||
} // namespace math
|
||
|
||
namespace input {
|
||
|
||
template <typename T>
|
||
std::vector<T> load_vector(std::size_t size) {
|
||
std::vector<T> result{};
|
||
|
||
for (auto i = 0u; i < size; ++i) {
|
||
T x;
|
||
std::cin >> x;
|
||
result.push_back(std::move(x));
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
} // namespace input
|
||
|
||
namespace output {
|
||
|
||
template <typename T>
|
||
inline void answer(const T &ans) {
|
||
cout << ans << "\n";
|
||
}
|
||
|
||
inline void yes() { cout << "YES\n"; }
|
||
inline void no() { cout << "NO\n"; }
|
||
|
||
inline void yesno(bool ans) {
|
||
if (ans) {
|
||
yes();
|
||
} else {
|
||
no();
|
||
}
|
||
}
|
||
|
||
} // namespace output
|
||
|
||
using namespace math;
|
||
using namespace input;
|
||
using namespace output;
|
||
|
||
#define LOOP(n) for (auto i = 0; i < n; ++i)
|
||
|
||
} // namespace helpers
|
||
|
||
// for ‹N› test cases, uncomment for single test case
|
||
// #define SINGLE
|
||
|
||
namespace solution {
|
||
|
||
using namespace std;
|
||
using namespace helpers;
|
||
|
||
void solve() {
|
||
// TODO
|
||
}
|
||
|
||
} // namespace solution
|
||
|
||
using namespace solution;
|
||
|
||
#ifdef TEST
|
||
|
||
#include "../.common/cpp/catch_amalgamated.hpp"
|
||
|
||
TEST_CASE("examples") {
|
||
// TODO
|
||
}
|
||
|
||
#else
|
||
|
||
int main(void) {
|
||
|
||
#ifdef SINGLE
|
||
|
||
solution::solve();
|
||
|
||
#else
|
||
|
||
// for multiple test cases
|
||
int N;
|
||
std::cin >> N >> std::ws;
|
||
|
||
for (auto i = 0; i < N; ++i) {
|
||
solution::solve();
|
||
}
|
||
|
||
#endif
|
||
|
||
return 0;
|
||
}
|
||
|
||
#endif
|