codeforces-scrape

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

1395A.md (1672B)


      1 Source: https://codeforces.com/problemset/problem/1395/A
      2 
      3 A. Boboniu Likes to Color Balls
      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 Boboniu gives you
     22 
     23 * $r$ red balls,
     24 * $g$ green balls,
     25 * $b$ blue balls,
     26 * $w$ white balls.
     27 
     28 He allows you to do the following operation as many times as you want:
     29 
     30 * Pick a red ball, a green ball, and a blue ball and then change their color to white.
     31 
     32 You should answer if it's possible to arrange all the balls into a palindrome after several (possibly zero) number of described operations.
     33 
     34 Input
     35 
     36 The first line contains one integer $T$ ($1\le T\le 100$) denoting the number of test cases.
     37 
     38 For each of the next $T$ cases, the first line contains four integers $r$, $g$, $b$ and $w$ ($0\le r,g,b,w\le 10^9$).
     39 
     40 Output
     41 
     42 For each test case, print "Yes" if it's possible to arrange all the balls into a palindrome after doing several (possibly zero) number of described operations. Otherwise, print "No".
     43 
     44 Example
     45 
     46 Input
     47 
     48 ```
     49 4
     50 0 1 1 1
     51 8 1 9 3
     52 0 0 0 0
     53 1000000000 1000000000 1000000000 1000000000
     54 ```
     55 
     56 Output
     57 
     58 ```
     59 No
     60 Yes
     61 Yes
     62 Yes
     63 ```
     64 
     65 Note
     66 
     67 In the first test case, you're not able to do any operation and you can never arrange three balls of distinct colors into a palindrome.
     68 
     69 In the second test case, after doing one operation, changing $(8,1,9,3)$ to $(7,0,8,6)$, one of those possible palindromes may be "rrrwwwbbbbrbbbbwwwrrr".
     70 
     71 A palindrome is a word, phrase, or sequence that reads the same backwards as forwards. For example, "rggbwbggr", "b", "gg" are palindromes while "rgbb", "gbbgr" are not. Notice that an empty word, phrase, or sequence is palindrome.