4/2/24, 9:00 AM Problem - 1761A - Codeforces
|
riteshnub | Logout
You have +385! Wow!
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP
PROBLEMS SUBMIT STATUS STANDINGS CUSTOM TEST
00:00:38
Pinely Round 1 (Div. 1 + Div. 2)
Finished
A. Two Permutations
time limit per test: 1 second Practice
memory limit per test: 256 megabytes
input: standard input
output: standard output
→ Virtual participation
You are given three integers n, a, and b. Determine if there exist two permutations p and q of
Virtual contest is a way to take part in past
length n, for which the following conditions hold: contest, as close as possible to participation
on time. It is supported only ICPC mode for
The length of the longest common prefix of p and q is a. virtual contests. If you've seen these
problems, a virtual contest is not for you -
The length of the longest common suffix of p and q is b. solve these problems in the archive. If you
just want to solve some problem from a
A permutation of length n is an array containing each integer from 1 to n exactly once. For contest, a virtual contest is not for you -
solve this problem in the archive. Never use
example, [2, 3, 1, 5, 4] is a permutation, but [1, 2, 2] is not a permutation (2 appears twice in someone else's code, read the tutorials or
the array), and [1, 3, 4] is also not a permutation (n = 3 but there is 4 in the array). communicate with other person during a
virtual contest.
Input Start virtual contest
Each test contains multiple test cases. The first line contains a single integer t (
4
1 ≤ t ≤ 10 ) — the number of test cases. The description of test cases follows.
→ Clone Contest to Mashup
The only line of each test case contains three integers n, a, and b (1 ≤ a, b ≤ n ≤ 100 ).
You can clone this contest to a mashup.
Output
For each test case, if such a pair of permutations exists, output "Yes"; otherwise, output "No". Clone Contest
You can output each letter in any case (upper or lower).
Example → Submit?
input Copy
Language: GNU G++17 7.3.0
4
1 1 1 Choose
2 1 2 Choose File No file chosen
file:
3 1 1
4 1 1 Submit
output Copy
Yes
No → Problem tags
No
Yes brute force constructive algorithms
*800
Note No tag edit access
In the first test case, [1] and [1] form a valid pair.
In the second test case and the third case, we can show that such a pair of permutations → Contest materials
doesn't exist.
Announcement (en)
In the fourth test case, [1, 2, 3, 4] and [1, 3, 2, 4] form a valid pair.
Tutorial (en)
Codeforces (c) Copyright 2010-2024 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: Apr/02/2024 08:58:23UTC+5.5 (g1).
Desktop version, switch to mobile version.
Privacy Policy
Supported by
https://codeforces.com/problemset/problem/1761/A 1/2
4/2/24, 9:00 AM Problem - 1761A - Codeforces
https://codeforces.com/problemset/problem/1761/A 2/2