codeforces-scrape

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

1260C.md (2125B)


      1 Source: https://codeforces.com/problemset/problem/1260/C
      2 
      3 C. Infinite Fence
      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 You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
     22 
     23 You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered from left to right from $0$):
     24 
     25 * if the index of the plank is divisible by $r$ (such planks have indices $0$, $r$, $2r$ and so on) then you must paint it red;
     26 * if the index of the plank is divisible by $b$ (such planks have indices $0$, $b$, $2b$ and so on) then you must paint it blue;
     27 * if the index is divisible both by $r$ and $b$ you can choose the color to paint the plank;
     28 * otherwise, you don't need to paint the plank at all (and it is forbidden to spent paint on it).
     29 
     30 Furthermore, the Government added one additional restriction to make your punishment worse. Let's list all painted planks of the fence in ascending order: if there are $k$ consecutive planks with the same color in this list, then the Government will state that you failed the labor and execute you immediately. If you don't paint the fence according to the four aforementioned conditions, you will also be executed.
     31 
     32 The question is: will you be able to accomplish the labor (the time is not important) or the execution is unavoidable and you need to escape at all costs.
     33 
     34 Input
     35 
     36 The first line contains single integer $T$ ($1 \le T \le 1000$) — the number of test cases.
     37 
     38 The next $T$ lines contain descriptions of test cases — one per line. Each test case contains three integers $r$, $b$, $k$ ($1 \le r, b \le 10^9$, $2 \le k \le 10^9$) — the corresponding coefficients.
     39 
     40 Output
     41 
     42 Print $T$ words — one per line. For each test case print REBEL (case insensitive) if the execution is unavoidable or OBEY (case insensitive) otherwise.
     43 
     44 Example
     45 
     46 Input
     47 
     48 ```
     49 4
     50 1 1 2
     51 2 10 4
     52 5 2 3
     53 3 2 2
     54 ```
     55 
     56 Output
     57 
     58 ```
     59 OBEY
     60 REBEL
     61 OBEY
     62 OBEY
     63 ```