| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 222712 | shart23 | 이상한 기계 (APIO19_strange_device) | C++14 | 594 ms | 16852 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, a, b;
cin >> n >> a >> b;
long double k1 = a * (long double) b;
int k = (int) 1e18 + 1;
if (k1 <= 1e18) {
k = a * b;
}
vector<pair<int, int>> segs;
for (int i = 0; i < n; i++) {
int l, r;
cin >> l >> r;
if (r - l + 1 >= k) {
segs.emplace_back(0, k - 1);
continue;
}
int l1 = l % k, r1 = r % k;
if (r1 < l1) {
segs.emplace_back(0, r1);
segs.emplace_back(l1, k - 1);
} else {
segs.emplace_back(l1, r1);
}
}
sort(segs.begin(), segs.end());
int mxr = -1;
int res = 0;
for (auto x : segs) {
res += max(x.second - max(mxr, x.first - 1), 0LL);
mxr = max(x.second, mxr);
}
cout << res << endl;
}| # | 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... | ||||
