Kyopro Library
 
読み取り中…
検索中…
一致する文字列を見つけられません
debug.hpp
[詳解]
1#include"../kyopro_library/data_structure/fenwick_tree.hpp"
2#include"../kyopro_library/data_structure/segtree.hpp"
3#include"../kyopro_library/data_structure/segtree_lazy.hpp"
4#include"../kyopro_library/data_structure/segtree_dual.hpp"
5#include"../kyopro_library/graph/dsu.hpp"
6#include"../kyopro_library/others/int128.hpp"
7#include"../atcoder/modint"
8#include"../atcoder/segtree"
9#include"../atcoder/lazysegtree"
10#include"../atcoder/fenwicktree"
11#include"../atcoder/dsu"
12
13ostream& operator<<(ostream& os, atcoder::modint998244353 a);
14ostream& operator<<(ostream& os, atcoder::modint1000000007 a);
15template<typename T, T(*op)(T,T), T(*e)()>
16ostream& operator<<(ostream& os, atcoder::segtree<T,op,e> a);
17template<typename T, T(*op)(T,T), T(*e)(), typename F, T(*mapping)(F,T), F(*composition)(F,F), F(*id)()>
18ostream& operator<<(ostream& os, atcoder::lazy_segtree<T,op,e,F,mapping,composition,id> a);
19template<typename T>
20ostream& operator<<(ostream& os, atcoder::fenwick_tree<T> a);
21template<typename T1, typename T2>
22ostream& operator<<(ostream& os, const pair<T1,T2>& p);
23template<typename T1, typename T2, typename T3>
24ostream& operator<<(ostream& os, const tuple<T1,T2,T3>& t);
25template<typename T1, typename T2, typename T3, typename T4>
26ostream& operator<<(ostream& os, const tuple<T1,T2,T3,T4>& t);
27template<typename T>
28ostream& operator<<(ostream& os, const vector<vector<vector<T>>>& a);
29template<typename T>
30ostream& operator<<(ostream& os, const vector<vector<T>>& a);
31template<typename T>
32ostream& operator<<(ostream& os, const vector<T>& a);
33template<typename T>
34ostream& operator<<(ostream& os, const set<T>& a);
35template<typename T>
36ostream& operator<<(ostream& os, const multiset<T>& a);
37template<typename T>
38ostream& operator<<(ostream& os, const deque<T>& a);
39template<typename T1, typename T2>
40ostream& operator<<(ostream& os, const map<T1,T2>& a);
41template<typename T>
42ostream& operator<<(ostream& os, queue<T> a);
43template<typename T>
44ostream& operator<<(ostream& os, priority_queue<T> a);
45template<typename T>
46ostream& operator<<(ostream& os, rpriority_queue<T> a);
47template<typename T, auto N>
48ostream& operator<<(ostream& os, array<T,N> a);
49ostream& operator<<(ostream& os, FenwickTree a);
50template<typename T>
51ostream& operator<<(ostream& os, SegTree<T> a);
52template<typename T, typename U, auto M>
53ostream& operator<<(ostream& os, SegTreeLazy<T,U,M> a);
54template<typename T>
55ostream& operator<<(ostream& os, SegTreeDual<T> a);
56ostream& operator<<(ostream& os, DSU a);
57ostream& operator<<(ostream& os, atcoder::dsu a);
58
59ostream& operator<<(ostream& os, atcoder::modint998244353 a) {
60 os<<a.val();
61 return os;
62}
63ostream& operator<<(ostream& os, atcoder::modint1000000007 a) {
64 os<<a.val();
65 return os;
66}
67template<typename T, T(*op)(T,T), T(*e)()>
68ostream& operator<<(ostream& os, atcoder::segtree<T,op,e> a) {
69 int n=a.get_size();
70 os<<"[";
71 for(int i=0; i<n; i++) {
72 os<<a.prod(i,i+1);
73 if(i!=n-1) os<<",";
74 }
75 os<<"]";
76 return os;
77}
78template<typename T, T(*op)(T,T), T(*e)(), typename F, T(*mapping)(F,T), F(*composition)(F,F), F(*id)()>
79ostream& operator<<(ostream& os, atcoder::lazy_segtree<T,op,e,F,mapping,composition,id> a) {
80 int n=a.get_size();
81 os<<"[";
82 for(int i=0; i<n; i++) {
83 os<<a.get(i);
84 if(i!=n-1) os<<",";
85 }
86 os<<"]";
87 return os;
88}
89template<typename T>
90ostream& operator<<(ostream& os, atcoder::fenwick_tree<T> a) {
91 int n=a.size();
92 os<<"[";
93 for(int i=0; i<n; i++) {
94 os<<a.sum(i,i+1);
95 if(i!=n-1) os<<",";
96 }
97 os<<"]";
98 return os;
99}
100template<typename T1, typename T2>
101ostream& operator<<(ostream& os, const pair<T1,T2>& p) {
102 os<<"("<<p.first<<","<<p.second<<")";
103 return os;
104}
105template<typename T1, typename T2, typename T3>
106ostream& operator<<(ostream& os, const tuple<T1,T2,T3>& t) {
107 os<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";
108 return os;
109}
110template<typename T1, typename T2, typename T3, typename T4>
111ostream& operator<<(ostream& os, const tuple<T1,T2,T3,T4>& t) {
112 os<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<","<<get<3>(t)<<")";
113 return os;
114}
115template<typename T>
116ostream& operator<<(ostream& os, const vector<vector<vector<T>>>& a) {
117 int I=a.size();
118 os<<"[\n";
119 for(int i=0; i<I; i++) {
120 os<<" "<<i<<":[\n";
121 int J=a[i].size();
122 for(int j=0; j<J; j++) {
123 os<<" "<<j<<":[";
124 int K=a[i][j].size();
125 for(int k=0; k<K; k++) {
126 os<<a[i][j][k];
127 if(k!=K-1) os<<",";
128 }
129 os<<"]\n";
130 }
131 os<<" ]\n";
132 }
133 os<<"]";
134 return os;
135}
136template<typename T>
137ostream& operator<<(ostream& os, const vector<vector<T>>& a) {
138 os<<"[\n";
139 int I=a.size();
140 for(int i=0; i<I; i++) {
141 os<<" "<<i<<":[";
142 int J=a[i].size();
143 for(int j=0; j<J; j++) {
144 os<<a[i][j];
145 if(j!=J-1) os<<",";
146 }
147 os<<"]\n";
148 }
149 os<<"]";
150 return os;
151}
152template<typename T>
153ostream& operator<<(ostream& os, const vector<T>& a) {
154 int n=a.size();
155 os<<"[";
156 for(int i=0; i<n; i++) {
157 os<<a[i];
158 if(i!=n-1) os<<",";
159 }
160 os<<"]";
161 return os;
162}
163template<typename T>
164ostream& operator<<(ostream& os, const set<T>& a) {
165 int n=a.size();
166 os<<"[";
167 for(T x:a) os<<x<<",";
168 os<<"]";
169 return os;
170}
171template<typename T>
172ostream& operator<<(ostream& os, const multiset<T>& a) {
173 int n=a.size();
174 os<<"[";
175 for(T x:a) os<<x<<",";
176 os<<"]";
177 return os;
178}
179template<typename T>
180ostream& operator<<(ostream& os, const deque<T>& a) {
181 int n=a.size();
182 os<<"[";
183 for(T x:a) os<<x<<",";
184 os<<"]";
185 return os;
186}
187template<typename T1, typename T2>
188ostream& operator<<(ostream& os, const map<T1,T2>& a) {
189 os<<"[";
190 for(pair<T1,T2> x:a) os<<x<<",";
191 os<<"]";
192 return os;
193}
194template<typename T>
195ostream& operator<<(ostream& os, queue<T> a) {
196 int n=a.size();
197 os<<"[";
198 while(!a.empty()) {
199 os<<a.front()<<",";
200 a.pop();
201 }
202 os<<"]";
203 return os;
204}
205template<typename T>
206ostream& operator<<(ostream& os, priority_queue<T> a) {
207 int n=a.size();
208 os<<"[";
209 while(!a.empty()) {
210 os<<a.top()<<",";
211 a.pop();
212 }
213 os<<"]";
214 return os;
215}
216template<typename T>
217ostream& operator<<(ostream& os, rpriority_queue<T> a) {
218 int n=a.size();
219 os<<"[";
220 while(!a.empty()) {
221 os<<a.top()<<",";
222 a.pop();
223 }
224 os<<"]";
225 return os;
226}
227template<typename T, auto N>
228ostream& operator<<(ostream& os, array<T,N> a) {
229 os<<"[";
230 for(int i=0; i<N; i++) {
231 os<<a[i];
232 if(i!=N-1) os<<",";
233 }
234 os<<"]";
235 return os;
236}
237ostream& operator<<(ostream& os, FenwickTree a) {
238 int n=a.size();
239 os<<"[";
240 for(int i=0; i<n; i++) {
241 os<<a[i];
242 if(i!=n-1) os<<",";
243 }
244 os<<"]";
245 return os;
246}
247template<typename T>
248ostream& operator<<(ostream& os, SegTree<T> a) {
249 int n=a.size();
250 os<<"[";
251 for(int i=0; i<n; i++) {
252 os<<a[i];
253 if(i!=n-1) os<<",";
254 }
255 os<<"]";
256 return os;
257}
258template<typename T, typename U, auto M>
259ostream& operator<<(ostream& os, SegTreeLazy<T,U,M> a) {
260 int n=a.size();
261 os<<"[";
262 for(int i=0; i<n; i++) {
263 os<<a[i];
264 if(i!=n-1) os<<",";
265 }
266 os<<"]";
267 return os;
268}
269template<typename T>
270ostream& operator<<(ostream& os, SegTreeDual<T> a) {
271 int n=a.size();
272 os<<"[";
273 for(int i=0; i<n; i++) {
274 os<<a[i];
275 if(i!=n-1) os<<",";
276 }
277 os<<"]";
278 return os;
279}
280ostream& operator<<(ostream& os, DSU a) {
281 vector<vector<int>> group=a.groups();
282 os<<group;
283 return os;
284}
285ostream& operator<<(ostream& os, atcoder::dsu a) {
286 vector<vector<int>> group=a.groups();
287 os<<group;
288 return os;
289}
290
291#define print_line cerr<<"--------------------"<<__LINE__<<"--------------------"<<"\n"
292#define debug(...) DebugPrint(0,#__VA_ARGS__,__VA_ARGS__)
293#define getName(VariableName) #VariableName
294
295template<typename T>
296void DebugPrint(int i, T name) { cerr<<endl; }
297template<typename T1, typename T2, typename...T3>
298void DebugPrint(int i, const T1& name, const T2& a, const T3& ...b) {
299 cerr<<"\033[31m";
300 int tmp=0;
301 while(true) {
302 if(name[i]=='\0') break;
303 if(tmp==0&&name[i]==',') break;
304 cerr<<name[i];
305 if(name[i]=='(') tmp++;
306 else if(name[i]==')') tmp--;
307 i++;
308 }
309 cerr<<"\033[32m";
310 cerr<<":"<<a<<",";
311 cerr<<"\033[0m";
312 DebugPrint(i+1,name,b...);
313}
ostream & operator<<(ostream &os, SegTree< T > a)
Definition debug.hpp:248
ostream & operator<<(ostream &os, FenwickTree a)
Definition debug.hpp:237
ostream & operator<<(ostream &os, SegTreeDual< T > a)
Definition debug.hpp:270
ostream & operator<<(ostream &os, atcoder::segtree< T, op, e > a)
Definition debug.hpp:68
ostream & operator<<(ostream &os, const pair< T1, T2 > &p)
Definition debug.hpp:101
ostream & operator<<(ostream &os, SegTreeLazy< T, U, M > a)
Definition debug.hpp:259
ostream & operator<<(ostream &os, const tuple< T1, T2, T3, T4 > &t)
Definition debug.hpp:111
ostream & operator<<(ostream &os, atcoder::modint998244353 a)
Definition debug.hpp:59
ostream & operator<<(ostream &os, array< T, N > a)
Definition debug.hpp:228
void DebugPrint(int i, T name)
Definition debug.hpp:296
ostream & operator<<(ostream &os, atcoder::lazy_segtree< T, op, e, F, mapping, composition, id > a)
Definition debug.hpp:79
ostream & operator<<(ostream &os, const tuple< T1, T2, T3 > &t)
Definition debug.hpp:106
ostream & operator<<(ostream &os, DSU a)
Definition debug.hpp:280
void DebugPrint(int i, const T1 &name, const T2 &a, const T3 &...b)
Definition debug.hpp:298
ostream & operator<<(ostream &os, atcoder::fenwick_tree< T > a)
Definition debug.hpp:90
ostream & operator<<(ostream &os, const vector< vector< vector< T > > > &a)
Definition debug.hpp:116
Disjoint Set Union
Definition dsu.hpp:5
Fenwick Tree
ll operator[](int i)
双対セグメント木
セグメント木
Definition segtree.hpp:6