{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cp\u003eYour friend is an organizer of the International Chess\n Playing Championship. He is worried that some of the\n contestants may be cheating, and he has asked you to help out.\n The chess players are allowed to report matches to the jury\n themselves, and this is not checked with the reported opponent.\n So, it is possible for competitors to make up matches and\n falsely report themselves as the winners.\u003c/p\u003e\n \u003cp\u003eSince chess is a game of skill, and not of chance, a player\n will \u003cem\u003ealways\u003c/em\u003e beat their opponent if their skill level\n is higher. A game will result in a draw if and only if the two\n players’ skills are exactly equal.\u003c/p\u003e\n \u003cp\u003eHowever, the skill level of the players is not known. He has\n therefore asked you to write a program that, given a list of\n reported matches, determines whether this list is consistent or\n not. The list is inconsistent if we can determine that at least\n one reported match is falsely reported, otherwise it is\n consistent.\u003c/p\u003e\n \u003ch2\u003eInput\u003c/h2\u003e\n \u003cp\u003eThe first line contains two integers \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$2\n \\leq N \\leq 50\\, 000$\u003c/span\u003e) and \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1\n \\leq M \\leq 250\\, 000$\u003c/span\u003e), to describe a championship with\n \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e players and\n \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e reported matches.\u003c/p\u003e\n \u003cp\u003eThe following \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e lines\n each consist of an integer \u003cspan class\u003d\"tex2jax_process\"\u003e$K$\u003c/span\u003e, a symbol which is either\n ‘\u003ctt class\u003d\"ttfamily\"\u003e\u003d\u003c/tt\u003e’ or ‘\u003ctt class\u003d\"ttfamily\"\u003e\u0026gt;\u003c/tt\u003e’, and another integer \u003cspan class\u003d\"tex2jax_process\"\u003e$L$\u003c/span\u003e. The integers \u003cspan class\u003d\"tex2jax_process\"\u003e$K$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$L$\u003c/span\u003e each uniquely identify a player\n (\u003cspan class\u003d\"tex2jax_process\"\u003e$0 \\leq K, L \u0026lt; N$\u003c/span\u003e). If\n the symbol is ‘\u003ctt class\u003d\"ttfamily\"\u003e\u003d\u003c/tt\u003e’, then the game\n between \u003cspan class\u003d\"tex2jax_process\"\u003e$K$\u003c/span\u003e and\n \u003cspan class\u003d\"tex2jax_process\"\u003e$L$\u003c/span\u003e was a draw. If the\n symbol is ‘\u003ctt class\u003d\"ttfamily\"\u003e\u0026gt;\u003c/tt\u003e’, then \u003cspan class\u003d\"tex2jax_process\"\u003e$K$\u003c/span\u003e beat \u003cspan class\u003d\"tex2jax_process\"\u003e$L$\u003c/span\u003e in a match.\u003c/p\u003e\n \u003cp\u003eYou may assume that there is at most one reported match\n between any given pair of players. Also, each player takes part\n in at least one reported match.\u003c/p\u003e\n \u003ch2\u003eOutput\u003c/h2\u003e\n \u003cp\u003eOutput a single line containing a single word: “\u003ctt class\u003d\"ttfamily\"\u003econsistent\u003c/tt\u003e” if the list of recorded matches is\n consistent, and “\u003ctt class\u003d\"ttfamily\"\u003einconsistent\u003c/tt\u003e” if it\n is not.\u003c/p\u003e\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 3\n0 \u0026gt; 1\n1 \u003d 2\n0 \u003d 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003einconsistent\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n \u003ch2\u003eSample 2\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5 5\n0 \u003d 1\n1 \u003d 2\n3 \u003d 4\n0 \u0026gt; 3\n1 \u0026gt; 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003econsistent\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n \u003ch2\u003eSample 3\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6 5\n0 \u0026gt; 1\n1 \u0026gt; 2\n3 \u003d 4\n4 \u003d 5\n5 \u0026gt; 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003einconsistent\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}