codeforces-scrape

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

1102C.md (2000B)


      1 Source: https://codeforces.com/problemset/problem/1102/C
      2 
      3 C. Doors Breaking and Repairing
      4 
      5 time limit per test
      6 
      7 1 second
      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 You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of two phases. During the first phase you make your move and during the second phase Slavik makes his move.
     22 
     23 There are $n$ doors, the $i$-th door initially has durability equal to $a_i$.
     24 
     25 During your move you can try to break one of the doors. If you choose door $i$ and its current durability is $b_i$ then you reduce its durability to $max(0, b_i - x)$ (the value $x$ is given).
     26 
     27 During Slavik's move he tries to repair one of the doors. If he chooses door $i$ and its current durability is $b_i$ then he increases its durability to $b_i + y$ (the value $y$ is given). Slavik cannot repair doors with current durability equal to $0$.
     28 
     29 The game lasts $10^{100}$ turns. If some player cannot make his move then he has to skip it.
     30 
     31 Your goal is to maximize the number of doors with durability equal to $0$ at the end of the game. You can assume that Slavik wants to minimize the number of such doors. What is the number of such doors in the end if you both play optimally?
     32 
     33 Input
     34 
     35 The first line of the input contains three integers $n$, $x$ and $y$ ($1 \le n \le 100$, $1 \le x, y \le 10^5$) — the number of doors, value $x$ and value $y$, respectively.
     36 
     37 The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^5$), where $a_i$ is the initial durability of the $i$-th door.
     38 
     39 Output
     40 
     41 Print one integer — the number of doors with durability equal to $0$ at the end of the game, if you and Slavik both play optimally.
     42 
     43 Examples
     44 
     45 Input
     46 
     47 ```
     48 6 3 2
     49 2 3 1 3 4 2
     50 ```
     51 
     52 Output
     53 
     54 ```
     55 6
     56 ```
     57 
     58 Input
     59 
     60 ```
     61 5 3 3
     62 1 2 4 2 3
     63 ```
     64 
     65 Output
     66 
     67 ```
     68 2
     69 ```
     70 
     71 Input
     72 
     73 ```
     74 5 5 6
     75 1 2 6 10 3
     76 ```
     77 
     78 Output
     79 
     80 ```
     81 2
     82 ```
     83 
     84 Note
     85 
     86 Clarifications about the optimal strategy will be ignored.