codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

2097A.md (2390B)


      1 Source: https://codeforces.com/problemset/problem/2097/A
      2 
      3 A. Sports Betting
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 The boarding process for various flights can occur in different ways: either by bus or through a telescopic jet bridge. Every day, exactly one flight is made from St. Petersburg to Minsk, and Vadim decided to demonstrate to the students that he always knows in advance how the boarding will take place.
     22 
     23 Vadim made a bet with $n$ students, and with the $i$-th student, he made a bet on day $a_i$. Vadim wins the bet if he correctly predicts the boarding process on both day $a_i+1$ and day $a_i+2$.
     24 
     25 Although Vadim does not know in advance how the boarding will occur, he really wants to win the bet at least with one student and convince him of his predictive abilities. Check if there exists a strategy for Vadim that allows him to guarantee success.
     26 
     27 Input
     28 
     29 Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.
     30 
     31 The first line of each test case contains a single integer $n$ ($1 \le n \le 10^5$) — the number of students Vadim made bets with.
     32 
     33 The second line of each test case contains $n$ integers $a_1, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the days on which Vadim made bets with the students.
     34 
     35 It is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.
     36 
     37 Output
     38 
     39 For each test case, output "Yes" (without quotes) if Vadim can guarantee convincing at least one student, and "No" otherwise.
     40 
     41 You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.
     42 
     43 Example
     44 
     45 Input
     46 
     47 ```
     48 5
     49 
     50 4
     51 
     52 1 1 1 1
     53 
     54 3
     55 
     56 2 2 2
     57 
     58 5
     59 
     60 2 4 3 2 4
     61 
     62 8
     63 
     64 6 3 1 1 5 1 2 6
     65 
     66 1
     67 
     68 1000000000
     69 ```
     70 
     71 Output
     72 
     73 ```
     74 Yes
     75 No
     76 Yes
     77 No
     78 No
     79 ```
     80 
     81 Note
     82 
     83 In the first test case, Vadim needs to make at least one correct prediction about the boarding process on the second and third days. There are a total of $4$ possible boarding scenarios for these days, so Vadim can give all $4$ students different predictions and guarantee that at least one of them will be correct.
     84 
     85 In the second test case, Vadim only made bets with three students and cannot guarantee that he will provide at least one of them with a correct prediction.