ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > IMPC - 2013-2014 > задача:


14-05-50. 50414 - Traffic

IMPC - 2013-2014

Старт: 16.мар.2013 в 12:00:00
Финиш: 16.мар.2013 в 17:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (1)

Задачи турнира

• 14-04-40. 50712 - Moon algebra
• 14-04-50. 50697 - Base Stations
• 14-05-10. 50723 - Tribonacci
• 14-05-20. 50677 - The Cottage
• 14-05-20. 50413 - Valid Permutations
• 14-05-30. 50688 - Epoka Furgon
• 14-05-30. 50706 - The most crowd...
• 14-05-40. 50689 - The biggest build...
• 14-05-50. 50414 - Traffic
• 14-05-50. 50421 - Repairing road s...
• 14-05-60. 50371 - Modified Karnaug...
• 14-05-70. 50477 - Character Pyramids
• 14-05-80. 50372 - Number Quadrup...
• 14-05-90. 50549 - k-Nearest Neigh...
• 14-05-95. 50479 - Bit Compressor
• 14-07-10. 50383 - Noisy Mornings
• 14-07-20. 50384 - Permutations revi...

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Osman Ay.

Traffic

Question: The heavy traffic is one of the major problems of big cities. The city municipalities try to find different solutions for this problem. The solution of the Tirana municipality is to make all the roads in the city only in one direction. So that, no two cars will block a narrow road. The only issue of this solution is that if it is possible to reach from any point of the city to any other point after the transformation. Make a program that reads the current undirected road connections of the city and determines if it is possible to convert all the roads to directed roads and still possible to travel between any two places.

Input specification
The first line of the test case contains two integers C (1 < C ≤ 30000) and R (1 ≤ R ≤ 100000) where C is the number of the road conjunctions and R is the number of the roads in the city. There are no parallel roads and no road connects a junction to itself. Each of the following R lines determines a road with two integers. Those integers represent numbers of two conjunctions connected with the road. The conjunctions are numbered from 1 to C.

Output specification
The output contains a single word "YES" or "NO".

 Sample Input I   
 4 5
 1 2
 4 3
 2 4
 4 1
 2 3
 Sample Input II  
 3 3
 1 3
 2 1
 3 1
 Sample Output I  
 YES
 Sample Output II  
 NO


Для отправки решений необходимо выполнить вход.

www.contester.ru