MARKSTW - Editorial

PROBLEM LINK:

Contest
Practice

Setter: srikkanth_adm
Testers: tabr
Editorialist: aryanag_adm

DIFFICULTY:

362

PREREQUISITES:

None

PROBLEM:

You are given two integers X and Y. Output “Yes” if X \geq 2 \cdot Y, and “No” otherwise.

EXPLANATION:

We can check in O(1) whether X \geq 2 \cdot Y, and then print the appropriate output using if-else.

TIME COMPLEXITY:

Time complexity is O(1).

SOLUTION:

Editorialist's Solution
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#include <sys/resource.h>
#define double long double
#define initrand mt19937 mt_rand(time(0));
#define rand mt_rand()
#define MOD 1000000007
#define INF 1000000000
#define mid(l, u) ((l+u)/2)
#define rchild(i) (i*2 + 2)
#define lchild(i) (i*2 + 1)
#define mp(a, b) make_pair(a, b)
#define lz lazup(l, u, i);
#define ordered_set tree<pair<int, int>, null_type,less<pair<int, int>>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int x, y;
    cin>>x>>y;
    if(x>=2*y) cout<<"Yes\n";
    else cout<<"No\n";
}