Submission #2846423


Source Code Expand

Copy
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

long long gcd(long long x, long long y){
  if(x < y) swap(x,y);
  if(!y) return x;
  return gcd(y,x%y);
}

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

Submission Info

Submission Time
Task B - rng_10s
User TAB
Language C++14 (GCC 5.4.1)
Score 0
Code Size 848 Byte
Status
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
× 2
× 2
× 3
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 1 ms 256 KB
example_1 1 ms 256 KB
multi_0 2 ms 256 KB
multi_1 2 ms 256 KB
multi_2 2 ms 256 KB