Codeforces Round 1045 (Div. 2)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
2134 Codeforces Round 1045 (Div. 2) FINISHED False 7200 20186723 Aug. 26, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 26457 ) A Painting With Two Colors PROGRAMMING constructive algorithms implementation math

You are given three positive integers (n), (a), and (b) ((1\leq a,b \leq n)). Consider a row of (n) cells, initially all white and indexed from (1) to (n). You will perform the following two steps in order : Choose an integer (x) such that (1 \le x \le n - a + 1), and paint the (a) consecutive cells (x, x+1, \ldots, x+a-1) red. Choose an integer (y) such that (1 \le y \le n - b + 1), and paint the (b) consecutive cells (y, y+1, \ldots, y+b-1) blue. If a cell is painted both red and blue, its final color is blue. A coloring of the grid is considered symmetric if, for every integer (i) from (1) to (n) (inclusive), the color of cell (i) is the same as the color of cell ((n+1-i)). Your task is to determine whether there exist integers (x) and (y) such that the final coloring of the grid is symmetric. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 500)). The description of the test cases follows. The first and the only line of each test case contains three integers (n), (a), and (b) ((1 \le n \le 10^9), (1 \le a,b \le n)) — the number of cells of the grid and the number of cells to be painted in each step. For each testcase, output " YES " if it is possible that the final coloring of the grid is symmetric; otherwise, output " NO ". 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. In the first test case, the grid becomes symmetric when choosing (x = 2) and (y = 3), so the answer is " YES ". The following figure illustrates each step of the coloring process: In the second test case, the grid becomes symmetric when choosing (x = 2) and (y = 2), so the answer is " YES ". The following figure illustrates each step of the coloring process: In the third and fourth test

Tutorials

145832

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
335751337 Mohan_Patel A Aug. 27, 2025, 4:56 a.m. OK C# 10 TESTS 4 77 0
335711690 og.kostya A Aug. 26, 2025, 5:58 p.m. OK C# 13 TESTS 4 77 0

remove filters

Back to search problems