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