結果

問題 No.1048 Zero (Advanced)
ユーザー 山下山下
提出日時 2020-05-08 22:41:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 925 bytes
コンパイル時間 1,459 ms
コンパイル使用メモリ 166,900 KB
実行使用メモリ 124,964 KB
最終ジャッジ日時 2023-09-17 03:14:55
合計ジャッジ時間 2,511 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 26 ms
90,336 KB
testcase_05 WA -
testcase_06 AC 16 ms
58,300 KB
testcase_07 AC 33 ms
121,072 KB
testcase_08 AC 11 ms
40,164 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 9 ms
31,392 KB
testcase_11 AC 27 ms
101,240 KB
testcase_12 AC 6 ms
15,636 KB
testcase_13 AC 33 ms
124,964 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 33 ms
124,964 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}

int main() {
  ll l, r, m, k;
  cin >> l >> r >> m >> k;
  vector<bool> ama(m);
  if (k == 0) cout << "Yes" <<endl;
  else if (l%m==0 || r%m==0) cout << "Yes" <<endl;
  else if (l/m != r/m) {
    if (k == 1) cout << "No" <<endl;
    else cout << "Yes" <<endl;
  }
  else {
    ll R = r%m;
    ll L = l%m;
    if (k == 1) cout << "No" <<endl;
    else  if (L < m/2 && m/2 <= R) cout << "Yes" <<endl;
    else {
      if (L >= m/2) {
        ll LL = L;
        L = m-R;
        R = m - LL;
      }
      ll b = m/L;
      ll s;
      if (m%R==0) s = m/R;
      else s = m/R + 1;

      if (s<=k&&k<=b) cout << "Yes" <<endl;
      else cout << "No" <<endl;
    }
  }
}
0