301539: CF290F. Greedy Petya
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Greedy Petya
题意翻译
(本题出自 $CodeForces$ $2013$ 年愚人节比赛 $F$ 题) ## 题目描述 $Petya$ 是一个没有经验的编程选手,最近他遇到了下面的问题: 给定一个由 $n$ 个点和 $m$ 条边组成的无向图。请确定图形是否包含哈密尔顿路径。 $Petya$ 很快就编写了一份没有 $bug$ 的代码。他认为这份代码可以解决这个问题。之后, $Petya$ 决定在愚人节比赛中提出这个问题。不幸的是, $Petya$ 可能犯了一个错误,他的算法很可能是错误的。但这不是一个离开比赛而不提交这个问题的很好的借口,对吗? ## 输入输出格式 ### 输入格式 第一行为两个整数 $n$ 和 $m$ ( $1 \leqslant n \leqslant 20$ $0 \leqslant m \leqslant 400$ ),接下来 $m$ 行每行为一对整数 $(v_i,u_i)$ ( $1 \leqslant v_i,u_i \leqslant n$ )。 ### 输出格式 按照样例中给出的 $Petya$ 的代码输出的格式。题目描述
Petya is an unexperienced programming contestant. Recently he has come across the following problem: You are given a non-directed graph which consists of $ n $ nodes and $ m $ edges. Your task is to determine whether the graph contains a Hamiltonian path. Petya wrote a quick bug-free code which he believes solves this problem. After that Petya decided to give this problem for April Fools Day contest. Unfortunately, Petya might have made a mistake, and it's quite possible that his algorithm is wrong. But this isn't a good excuse to leave the contest without submitting this problem, is it?输入输出格式
输入格式
The first line contains two integers $ n,m $ $ (1<=n<=20; 0<=m<=400) $ . Next $ m $ lines contain pairs of integers $ v_{i},u_{i} $ $ (1<=v_{i},u_{i}<=n) $ .
输出格式
Follow the format of Petya's code output.
输入输出样例
输入样例 #1
2 3
1 2
2 1
1 1
输出样例 #1
Yes
输入样例 #2
3 0
输出样例 #2
No
输入样例 #3
10 20
3 10
4 6
4 9
7 5
8 8
3 10
9 7
5 2
9 2
10 6
10 4
1 1
7 2
8 4
7 2
1 8
5 4
10 2
8 5
5 2
输出样例 #3
No