# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
447193 | Ya_Ali | 이상한 기계 (APIO19_strange_device) | C++17 | 629 ms | 17040 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* ** *** In the name of God *** ** */
// Only Haider is Amir al-Momenin
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const ll maxn = 1e5 + 10;
const ll mod = 1e9 + 7;
const ll inf = 1e18 + 1;
// #define endl '\n'
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
ll n, A, B;
cin >> n >> A >> B;
ll x = 1ll * A / __gcd(A, B + 1);
if (x <= inf / B) x *= B;
else x = inf;
vector<pair<ll, ll>> b;
while (n--) {
ll l, r;
cin >> l >> r;
// l--, r--;
if (r - l + 1 >= x) return cout << x, 0;
l %= x, r %= x;
if (r >= l) b.push_back({l, r});
else b.push_back({l, x - 1}), b.push_back({0, r});
}
sort(b.begin(), b.end());
ll p = 0, ans = x;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |