DOUBTSUPPORT-Editorial

PROBLEM LINK:

Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4

Setter: Hrishikesh
Tester: Satyam, Utkarsh Gupta
Editorialist: Devendra Singh

DIFFICULTY:

To be calculated

PREREQUISITES:

None

PROBLEM:

On the CodeChef Practice page, problems with difficulty ≤1600 now have Doubt Support — you can go to the problem page and get your queries answered by an experienced CodeChef Doubt Solver through the “Doubt Support” tab.

Given the difficulty of a problem, output whether this problem has Doubt Support or not.

EXPLANATION:

Problems with difficulty ≤1600 have Doubt Support. Therefore if difficulty of a question is less than or equal to 1600 it has a doubt support otherwise it does not.
Output Yes if Difficulty <= 1600 otherwise NO.

TIME COMPLEXITY:

O(1) or for each test case.

SOLUTION:

Setter's solution
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
const int iu=10000;
const ll mod=998244353;
ll n;
int a[2001];
// -------------------- Input Checker Start --------------------

long long readInt(long long l, long long r, char endd)
{
    long long x = 0;
    int cnt = 0, fi = -1;
    bool is_neg = false;
    while(true)
    {
        char g = getchar();
        if(g == '-')
        {
            assert(fi == -1);
            is_neg = true;
            continue;
        }
        if('0' <= g && g <= '9')
        {
            x *= 10;
            x += g - '0';
            if(cnt == 0)
                fi = g - '0';
            cnt++;
            assert(fi != 0 || cnt == 1);
            assert(fi != 0 || is_neg == false);
            assert(!(cnt > 19 || (cnt == 19 && fi > 1)));
        }
        else if(g == endd)
        {
            if(is_neg)
                x = -x;
            if(!(l <= x && x <= r))
            {
                cerr << l << ' ' << r << ' ' << x << '\n';
                assert(false);
            }
            return x;
        }
        else
        {
            assert(false);
        }
    }
}

string readString(int l, int r, char endd)
{
    string ret = "";
    int cnt = 0;
    while(true)
    {
        char g = getchar();
        assert(g != -1);
        if(g == endd)
            break;
        cnt++;
        ret += g;
    }
    assert(l <= cnt && cnt <= r);
    return ret;
}

long long readIntSp(long long l, long long r) { return readInt(l, r, ' '); }
long long readIntLn(long long l, long long r) { return readInt(l, r, '\n'); }
string readStringLn(int l, int r) { return readString(l, r, '\n'); }
string readStringSp(int l, int r) { return readString(l, r, ' '); }
void readEOF() { assert(getchar() == EOF); }

vector<int> readVectorInt(int n, long long l, long long r)
{
    vector<int> a(n);
    for(int i = 0; i < n - 1; i++)
        a[i] = readIntSp(l, r);
    a[n - 1] = readIntLn(l, r);
    return a;
}

// -------------------- Input Checker End --------------------
void solve(){
	ll x,y,z;
	x=readInt(1,100,' ');y=readInt(1,100,' ');z=readInt(1,100,'\n');
	cout << (z>=x)+(z>=x+y) << '\n';
}
int main(){
	ios::sync_with_stdio(false);
	ll a = readIntLn(1, 5000);
	readEOF();
	if(a<=1600)
	    cout<<"yeS\n";
	else
	    cout<<"nO\n";
}
Editorialist's Solution
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define pb push_back
#define all(_obj) _obj.begin(), _obj.end()
#define F first
#define S second
#define pll pair<ll, ll>
#define vll vector<ll>
ll INF = 1e18;
const int N = 1e5 + 11, mod = 1e9 + 7;
ll max(ll a, ll b) { return ((a > b) ? a : b); }
ll min(ll a, ll b) { return ((a > b) ? b : a); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void sol(void)
{
    int D;
    cin >> D;
    cout << ((D <= 1600) ? "YES" : "NO");
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    int test = 1;
    // cin>>test;
    while (test--)
        sol();
}