Submission #3044673


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b){
    if(a<b) return gcd(b,a);
    if(a%b==0) return b;
    return gcd(b,a%b);
}

int main(){
    int T;
    cin >> T;
    for(int i=0;i<T;i++){
        ll A,B,C,D;
        cin >> A >> B >> C >> D;
        if(B>A || B>D){
            cout << "No" << endl;
            continue;
        }
        if(C>=B || A<=C){
            cout << "Yes" << endl;
            continue;
        }
        ll g=gcd(B,D);
        if((A-C)/g-(A-B)/g > 1 || ((A-C)/g-(A-B)/g==1) && (A-C)%g!=0){
            cout << "No" << endl;
            continue;
        }else{
            cout << "Yes" << endl;
        }
    }
    return 0;
}

Submission Info

Submission Time
Task B - rng_10s
User wisteria0410ss
Language C++14 (GCC 5.4.1)
Score 600
Code Size 767 Byte
Status AC
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 2
AC × 5
Set Name Test Cases
Sample example_0, example_1
All example_0, example_1, multi_0, multi_1, multi_2
Case Name Status Exec Time Memory
example_0 AC 1 ms 256 KB
example_1 AC 1 ms 256 KB
multi_0 AC 2 ms 256 KB
multi_1 AC 2 ms 256 KB
multi_2 AC 2 ms 256 KB