| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 497796 | MilosMilutinovic | Strange Device (APIO19_strange_device) | C++14 | 643 ms | 86224 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
ll A, B;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(11);
cerr << fixed << setprecision(6);
cin >> n >> A >> B;
A /= __gcd(A, B + 1);
ll mod = 1e18 + 1;
if (A <= (LLONG_MAX / 2) / B) mod = A * B;
vector<pair<ll, ll>> vec;
for (int i = 0; i < n; ++i) {
ll l, r;
cin >> l >> r;
ll len = r - l + 1;
if (len >= mod) {
cout << mod << "\n";
return 0;
}
l = l % mod;
r = r % mod;
if (l <= r) {
vec.push_back({l, r});
} else {
vec.push_back({l, mod - 1});
vec.push_back({0, r});
}
}
vector<pair<ll, int>> Events;
for (int i = 0; i < vec.size(); ++i) {
Events.push_back({vec[i].first, 0});
Events.push_back({vec[i].second, 1});
}
sort(Events.begin(), Events.end());
int bal = 0;
ll left = 0, tot = 0;
for (auto ev : Events) {
if (ev.second == 0) {
bal++;
if (bal == 1) left = ev.first;
} else {
bal--;
if (bal == 0) tot += ev.first - left + 1;
}
}
cout << tot << "\n";
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
