1
0
Fork 0

Update include.hh

Signed-off-by: subcrip <contact@subc.rip>
This commit is contained in:
subcrip 2024-05-13 11:45:47 +08:00
parent 671fb5fc4a
commit ab639d9938
1 changed files with 5 additions and 3 deletions

View File

@ -15,7 +15,7 @@ using namespace std;
#define __DECOMPOSE_N(a, ...) auto [__VA_ARGS__] = a; #define __DECOMPOSE_N(a, ...) auto [__VA_ARGS__] = a;
constexpr void __() {} constexpr void __() {}
#define __AS_PROCEDURE(...) __(); __VA_ARGS__; __() #define __AS_PROCEDURE(...) __(); __VA_ARGS__; __()
#define __as_typeof(container) decltype(container)::value_type #define __as_typeof(container) remove_reference<decltype(container)>::type
/* type aliases */ /* type aliases */
#if LONG_LONG_MAX != INT64_MAX #if LONG_LONG_MAX != INT64_MAX
@ -203,8 +203,10 @@ template <typename T, typename Iterator> pair<size_t, unordered_map<T, size_t, s
template<typename T> void __read(T& x) { cin >> x; } template<typename T> void __read(T& x) { cin >> x; }
template<typename T, typename... U> void __read(T& x, U&... args) { cin >> x; __read(args...); } template<typename T, typename... U> void __read(T& x, U&... args) { cin >> x; __read(args...); }
#define read(type, ...) __AS_PROCEDURE(type __VA_ARGS__; __read(__VA_ARGS__);) #define read(type, ...) __AS_PROCEDURE(type __VA_ARGS__; __read(__VA_ARGS__);)
#define readvec(type, a, n) __AS_PROCEDURE(vector<type> a(n); for (int i = 0; i < (n); ++i) cin >> a[i];) #define readvec(type, a, n) __AS_PROCEDURE(vector<type> a(n); copy_n(ii<type>(cin), (n), a.begin());)
#define putvec(a) __AS_PROCEDURE(for (auto&& x : a) cout << x << ' '; cout << endl;) #define readvec1(type, a, n) __AS_PROCEDURE(vector<type> a((n) + 1); copy_n(ii<type>(cin), (n), a.begin() + 1);)
#define putvec(a) __AS_PROCEDURE(copy(a.begin(), a.end(), oi<__as_typeof(a)::value_type>(cout, " ")); cout << endl;)
#define putvec_eol(a) __AS_PROCEDURE(copy(a.begin(), a.end(), oi<__as_typeof(a)::value_type>(cout, "\n"));)
#define debug(x) __AS_PROCEDURE(cerr << #x" = " << (x) << endl;) #define debug(x) __AS_PROCEDURE(cerr << #x" = " << (x) << endl;)
#define debugvec(a) __AS_PROCEDURE(cerr << #a" = "; for (auto&& x : a) cerr << x << ' '; cerr << endl;) #define debugvec(a) __AS_PROCEDURE(cerr << #a" = "; for (auto&& x : a) cerr << x << ' '; cerr << endl;)
template<typename T, typename U> ostream& operator<<(ostream& out, const pair<T, U>& p) { template<typename T, typename U> ostream& operator<<(ostream& out, const pair<T, U>& p) {