7

Don't know how to solve this, and pls share your intuition. ty.

 2 years ago
source link: https://codeforces.com/blog/entry/109175?f0a28=1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

By cockass, history, 11 hours ago,

LINK- https://lightoj.com/contest/code-samurai-2022-preliminary/arena/problem/2353

i'm not sure if link is accessible, so i'm putting problem here. any help is very welcomed, because for u its tiny but for me its huge

Ajobdesh is so advanced in its transportation system that there is a road built between every pair of her N cities. Unfortunately, not all of them are kept open all the time. The traffic police reign supreme and decides which roads to keep open and which ones to close. Even though the Ajob Road Transportation Corporation (ARTC) built a lot of roads, the citizens still have to suffer traffic jams every day.

Every day, the traffic police select a city, close down all the open roads and open up all the closed roads between that city and every other city.

After observing this pattern while stuck at a traffic light, you have been wondering whether one day it would be possible that every road between every pair of cities gets opened up.

Input-----

The first line of input contains the integer N (2 ≤ N ≤ 1000), the number of cities. The cities are labeled with numbers from 1 to N.

The second line contains the integer M (0 ≤ M < N*(N-1)/2), the number of currently opened roads. Each of the following M lines contains two different numbers, the labels of the cities that are currently connected.

Output-------

Print a line containing YES if it is possible to have open roads betweem all pairs of cities. Print NO otherwise.

Sample------

Input 3 2 1 2 2 3 Output---- NO

Sample Input 4 2 1 3 2 4 Output---- YES

Notes---- Explanation of the 2nd input file: They first chose city 1. It open roads 1-2, 1-4, but closes 1-3. Then they chose city 3. It opens 3-1, 3-2, 3-4. The city already has 2-4 open, thus opening a road between every pairs of cities.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK