KEMBAR78
Problem - A - Codeforces | PDF | Applied Mathematics | Theoretical Computer Science
0% found this document useful (0 votes)
16 views2 pages

Problem - A - Codeforces

Uploaded by

yash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Problem - A - Codeforces

Uploaded by

yash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

9/13/25, 4:05 AM Problem - A - Codeforces

Enter | Register

HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN

PROBLEMS SUBMIT CODE MY SUBMISSIONS STATUS HACKS ROOM STANDINGS CUSTOM INVOCATION

Codeforces Round 1045 (Div. 2)


A. Painting With Two Colors Finished
time limit per test: 1 second
memory limit per test: 256 megabytes → Practice?
You are given three positive integers n, a, and b (1 ≤ a, b ≤ n ). Want to solve the contest problems after the
official contest ends? Just register for
practice and you will be able to submit
Consider a row of n cells, initially all white and indexed from 1 to n. You will perform the following solutions.
two steps in order:
Register for practice
1. Choose an integer x such that 1 ≤ x ≤ n − a + 1, and paint the a consecutive cells
x, x + 1, … , x + a − 1 red.

2. Choose an integer y such that 1 ≤ y ≤ n − b + 1 , and paint the b consecutive cells → Virtual participation 
y, y + 1, … , y + b − 1 blue.
Virtual contest is a way to take part in past
contest, as close as possible to participation
If a cell is painted both red and blue, its final color is blue. on time. It is supported only ICPC mode for
virtual contests. If you've seen these
A coloring of the grid is considered symmetric if, for every integer i from 1 to n (inclusive), the problems, a virtual contest is not for you -
solve these problems in the archive. If you
color of cell i is the same as the color of cell (n + 1 − i). Your task is to determine whether just want to solve some problem from a
there exist integers x and y such that the final coloring of the grid is symmetric. contest, a virtual contest is not for you -
solve this problem in the archive. Never use
someone else's code, read the tutorials or
Input communicate with other person during a
virtual contest.
Each test contains multiple test cases. The first line contains the number of test cases t (
1 ≤ t ≤ 500 ). The description of the test cases follows. Start virtual contest

The first and the only line of each test case contains three integers n, a, and b (1 ≤ n ≤ 109 ,
1 ≤ a, b ≤ n ) — the number of cells of the grid and the number of cells to be painted in each
→ Problem tags
step.
constructive algorithms implementation
Output
For each testcase, output "YES" if it is possible that the final coloring of the grid is symmetric; math *800
No tag edit access
otherwise, output "NO".

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes",
→ Contest materials
"Yes", and "YES" will be recognized as positive responses.
Announcement (en)
Example Tutorial (en)

input Copy

7
5 3 1
4 1 2
7 7 4
8 3 7
1 1 1
1000000000 1000000000 1000000000
3 2 1

output Copy

YES
YES
NO
NO
YES
YES
NO

Note
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:

https://codeforces.com/contest/2134/problem/A 1/2
9/13/25, 4:05 AM Problem - A - Codeforces

In the third and fourth test cases, it can be proved that no choice of x and y results in a
symmetric grid, so the answer is "NO".

Codeforces (c) Copyright 2010-2025 Mike Mirzayanov


The only programming contests Web 2.0 platform
Server time: Sep/13/2025 04:04:28UTC+5.5 (k2).
Desktop version, switch to mobile version.
Privacy Policy | Terms and Conditions

Supported by

https://codeforces.com/contest/2134/problem/A 2/2

You might also like