Editorial for Thi thử Duyên hải 2021 - Lần 2 - Bài 1 - PARALLEL


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: SPyofgame


~\color{goldenrod}{\text{Tiếp cận}}~

  • Có ~q~ truy vấn

  • Mỗi truy vấn nhận vào ~x, y~.

  • Điều kiện để in "Yes" là ~(x \leq 2\ ~ & ~\ y \leq 1)~ hoặc ~(x \leq 1\ ~ & ~\ y \leq 2)~. Ngược lại in "No"


~\color{green}{\text{Code tham khảo }}~: Approach

~^{^{\color{purple}{\text{Độ phức tạp : }} O(q)\ \color{purple}{\text{thời gian}}\ ||\ O(q)\ \color{purple}{\text{bộ nhớ}}}}~

#include <iostream>

using namespace std;

int main()
{
    int q;
    cin >> q;

    while (q-->0)
    {
        int x, y;
        cin >> x >> y;
        cout << ((x <= 2 && y <= 1) || (x <= 1 && y <= 2) ? "Yes" : "No") << '\n';
    }

    return 0;
}

Comments

Please read the guidelines before commenting.


There are no comments at the moment.