結果
| 問題 |
No.1048 Zero (Advanced)
|
| コンテスト | |
| ユーザー |
vtr_coder
|
| 提出日時 | 2020-05-08 22:32:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,344 bytes |
| コンパイル時間 | 1,435 ms |
| コンパイル使用メモリ | 165,520 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-04 00:58:02 |
| 合計ジャッジ時間 | 2,333 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 WA * 1 RE * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
# define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
# define DBG(fmt, ...)
#endif
const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010
// ユークリッドの互除法の変形
template <typename T> T gcd(T a, T b) { while (a) { b %= a; swap(a, b); } return b; }
// 最小公倍数
template <typename T> T lcm(T a, T b) { return a / gcd(a,b) * b; }
ll func(ll a, ll b, ll n) {
ll lcmab = lcm(a, b);
return lcmab * ((n + lcmab - 1) / lcmab);
}
signed main() {
cin.tie(0); cout.tie(0);
ios::sync_with_stdio(false);
int L, R, M, K;
cin >> L >> R >> M >> K;
if(K == 0 || (L <= M && M <= R)) {
printf("Yes\n");
return 0;
}
if(L % M > R % M) {
printf("Yes\n");
return 0;
}
L %= M;
R %= M;
int cand = func(L * K, M, L * K);
if(cand <= R * K) {
printf("Yes\n");
}
else {
printf("No\n");
}
return 0;
}
vtr_coder