Contest Duration: ~ (local time) (150 minutes) Back to Home

Submission #2847399

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;
}
if(A-B <= C && A-B+D < B){
cout << "No" << endl;
continue;
}
if(C >= B){
if(D >= B) cout << "Yes" << endl;
else cout << "No" << endl;
continue;
}
long long d = D%B;
//cout << ((A%B)%d+C-C%B)/d*d + C-C%B << endl;
//cout << (C - A%B)/d << " " <<  (B-A%B-1)/d << 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 2018-07-14 22:57:24+0900 B - rng_10s TAB C++14 (GCC 5.4.1) 0 1006 Byte WA 2 ms 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
 AC × 2
 AC × 2 WA × 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