[HIHO1176]欧拉路·一(欧拉图判定)

题目链接:http://hihocoder.com/problemset/problem/1176

思路:先判是否连通,再判是否有0个或2个度为奇数的点。

 /*
━━━━━┒ギリギリ♂ eye!
┓┏┓┏┓┃キリキリ♂ mind!
┛┗┛┗┛┃\○/
┓┏┓┏┓┃ /
┛┗┛┗┛┃ノ)
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┃┃┃┃┃┃
┻┻┻┻┻┻
*/
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define fr first
#define sc second
#define cl clear
#define BUG puts("here!!!")
#define W(a) while(a--)
#define pb(a) push_back(a)
#define Rint(a) scanf("%d", &a)
#define Rll(a) scanf("%lld", &a)
#define Rs(a) scanf("%s", a)
#define Cin(a) cin >> a
#define FRead() freopen("in", "r", stdin)
#define FWrite() freopen("out", "w", stdout)
#define Rep(i, len) for(int i = 0; i < (len); i++)
#define For(i, a, len) for(int i = (a); i < (len); i++)
#define Cls(a) memset((a), 0, sizeof(a))
#define Clr(a, x) memset((a), (x), sizeof(a))
#define Full(a) memset((a), 0x7f7f7f, sizeof(a))
#define lrt rt << 1
#define rrt rt << 1 | 1
#define pi 3.14159265359
#define RT return
#define lowbit(x) x & (-x)
#define onenum(x) __builtin_popcount(x)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<LL, LL> pll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef vector<vl> vvl;
typedef vector<bool> vb; const int maxn = ;
int n, m;
int d[maxn];
int pre[maxn]; int find(int x) { return x == pre[x] ? x : pre[x] = find(pre[x]); }
void unite(int x, int y) { x = find(x); y = find(y); if(x != y) pre[x] = y; } int main() {
// FRead();
int u, v;
while(~Rint(n) && ~Rint(m)) {
Cls(d); For(i, , n+) pre[i] = i;
Rep(i, m) {
Rint(u); Rint(v);
unite(u, v);
d[u]++; d[v]++;
}
bool exflag = ;
int cnt = ;
int fa = find();
For(i, , n+) {
if(fa != find(i)) exflag = ;
if(d[i] & ) cnt++;
}
if(!(cnt == || cnt == )) exflag = ;
exflag ? printf("Part\n") : printf("Full\n");
}
RT ;
}
上一篇:[转]C#中Timer使用及解决重入问题


下一篇:(收藏)sokcet编程