[BOJ 16583] Boomerangs
https://www.acmicpc.net/problem/16583 16583번: Boomerangs Let G = (V, E) be a simple undirected graph with N vertices and M edges, where V = {1, . . . , N}. A tuple is called as boomerang in G if and only if {(u, v),(v, w)} ⊆ E and u ≠ w; in other words, a boomerang consists of two edges which shar www.acmicpc.net Tag : constructive, greedy 문제요약 양방향 그래프 G(v, e)를 인접한 2개의 간선들로 분할하라. 이 때 인접한 2개의 간선쌍..
FastIO 템플릿
#include #include #include template struct FASTIO { char *p,O[2000000],*d; void set() { struct stat st;fstat(0,&st);d=O; p=(char*)mmap(0,st.st_size,1,1,0,0); } ~FASTIO() { write(1,O,d-O); } inline T get() { T x=0;bool e;p+=e=*p=='-'; for(;*p==10 or *p==32;p++); for(char c=*p++;c&16;x=10*x+(c&15),c=*p++); return e?-x:x; } inline void put(T x) { if(d-O+100>2000000) write(1,O,d-O), d=O; if(x