question: I will give you a picture and ask you how many pictures can be drawn, except for isolated points.
# Include <cstdio> # include <string. h >#include <vector >#include <string> # define n 100005 # include <algorithm> # include <iostream> using namespace STD; int father [N]; vector <int> A; // records the root node. Its length is the number of connected branches. Int in [N]; int num [N]; // The number of odd vertices of each connected branch. Bool hash [N]; int n, m; void Init () {memset (Num, 0, sizeof (Num); For (INT I = 1; I <= N; ++ I) Father [I] = I; memset (in, 0, sizeof (in); memset (hash, false, sizeof (hash);. clear () ;}int find (int x) {If (x = Father [x]) return X; return father [x] = find (father [x]);} void Union (int x, int y) {x = find (x); y = find (y); If (X! = Y) Father [x] = y;} int main () {While (~ Scanf ("% d", & N, & M) {Init (); For (INT I = 0; I! = M; ++ I) {int A, B; scanf ("% d", & A, & B); Union (A, B ); in [a] ++; in [B] ++;} int res = 0; For (INT I = 1; I <= N; ++ I) {int K = find (I); If (! Hash [k]) {hash [k] = true;. push_back (k);} If (in [I] & 1) num [k] ++;} For (INT I = 0; I <. size (); ++ I) {int K = A [I]; If (! In [k]) continue; If (Num [k] = 0) RES ++; else res + = num [k]/2 ;} printf ("% d \ n", Res);} return 0 ;}