Submission #3027288


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

#define ll long long

ll gcd(ll a, ll b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}

void solve() {
  ll a, b, c, d;
  scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
  if (a < b || d < b) {
    puts("NO");
    return ;
  } else if (b <= c + 1) {
    puts("YES");
    return ;
  }
  a -= b;
  if (a <= c) a += d;
  ll g = gcd(b, d);
  ll have = a - c - 1;
  if (b <= c + have % g + 1) {
    puts("YES");
  } else {
    puts("NO");
  }
}

main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    solve();
  }
}

Submission Info

Submission Time
Task B - rng_10s
User Shabdan
Language C++14 (GCC 5.4.1)
Score 0
Code Size 626 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘void solve()’:
./Main.cpp:17:47: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
                                               ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:38:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &test);
                     ^

Judge Result

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