Design Tutorial: Make It Nondeterministic
472C1400· specialist2s256 MB⌨ stdin/stdout
Examples
Sample 1of 5
Input
3gennady korotkevichpetr mitrichevgaoyuan chen1 2 3
Output
NO
Sample 2of 5
Input
3gennady korotkevichpetr mitrichevgaoyuan chen3 1 2
Output
YES
Sample 3of 5
Input
2galileo galileinicolaus copernicus2 1
Output
YES
Sample 4of 5
Input
10rean schwarzerfei claussellalisa reinfordeliot craiglaura arseidjusis albareamachias regnitzsara valestinemma millsteingaius worzel1 2 3 4 5 6 7 8 9 10
Output
NO
Sample 5of 5
Input
10rean schwarzerfei claussellalisa reinfordeliot craiglaura arseidjusis albareamachias regnitzsara valestinemma millsteingaius worzel2 4 9 6 5 7 1 3 8 10
Output
YES
58%
472C.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)