diff --git a/Debug.h b/Debug.h new file mode 100644 index 0000000..a796ca9 --- /dev/null +++ b/Debug.h @@ -0,0 +1,21 @@ +#include +using namespace std; +void __print(int x) {cerr << x;} +void __print(long x) {cerr << x;} +void __print(long long x){cerr << x;} +void __print(unsigned x){cerr << x;} +void __print(unsigned long x){cerr << x;} +void __print(unsigned long long x){cerr << x;} +void __print(float x){cerr << x;} +void __print(double x){cerr << x;} +void __print(long double x){cerr << x;} +void __print(char x){cerr << x;} +void __print(const char *x){cerr << x;} +void __print(const string &x){cerr << x;} +void __print(bool x){cerr << (x ? "true" : "false");} +void _print() { cerr << "\n"; } +template void __print(const A &x); template void __print(const pair &p); +template void __print(const A &x) {bool f=1; cerr << '['; for (const auto &i : x) {cerr << (f ? "" : ","), __print(i); f = 0;} cerr << ']';} +template void __print(const pair &p) {cerr << '('; __print(p.first); cerr << ','; __print(p.second); cerr << ')';} +template void _print(const Head &H, const Tail &...T) { __print(H); if (sizeof...(T)) cerr << ", "; _print(T...);} +#define dbg(x...) cerr << #x << " : "; _print(x) \ No newline at end of file diff --git a/Template/CPTemp.cpp b/Template/CPTemp.cpp index ddbe61d..c548602 100644 --- a/Template/CPTemp.cpp +++ b/Template/CPTemp.cpp @@ -1,5 +1,10 @@ #include using namespace std; +#ifndef ONLINE_JUDGE + #include "Debug.h" +#else + #define dbg(...) +#endif #define ll long long #define ull unsigned long long #define endl '\n' @@ -14,21 +19,7 @@ using namespace std; #define MOD 1000000007 #define FAST (ios_base:: sync_with_stdio(false),cin.tie(NULL)); ull mypow(ull a,ull b,ull m=MOD) {ull ans=1; a%=m; while(b){if(b&1) ans=(ans*a)%m; a=(a*a)%m; b>>=1;} return ans;} -#ifndef ONLINE_JUDGE -#define dbg(x...) cerr << #x << " : "; _print(x) -#else -#define dbg(...) -#endif -void __print(int x) {cerr << x;}void __print(long x) {cerr << x;} void __print(long long x){cerr << x;} -void __print(unsigned x){cerr << x;} void __print(unsigned long x){cerr << x;} void __print(unsigned long long x){cerr << x;} -void __print(float x){cerr << x;} void __print(double x){cerr << x;} void __print(long double x){cerr << x;} -void __print(char x){cerr << x;} void __print(const char *x){cerr << x;} void __print(const string &x){cerr << x;} -void __print(bool x){cerr << (x ? "true" : "false");} void _print() { cerr << "\n"; } -template void __print(const A &x); template void __print(const pair &p); -template void __print(const A &x) {bool f=1; cerr << '['; for (const auto &i : x) {cerr << (f ? "" : ","), __print(i); f = 0;} cerr << ']';} -template void __print(const pair &p) {cerr << '('; __print(p.first); cerr << ','; __print(p.second); cerr << ')';} -template void _print(const Head &H, const Tail &...T) { __print(H); if (sizeof...(T)) cerr << ", "; _print(T...);} -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void solve() {