| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 564186 | hoanghq2004 | 이상한 기계 (APIO19_strange_device) | C++14 | 614 ms | 35456 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
int main() {
ios :: sync_with_stdio(0); cin.tie(0);
int n;
long long A, B;
vector <pair <long long, int> > events;
cin >> n >> A >> B;
long long T = A / __gcd(A, B + 1) * B;
for (int i = 0; i < n; ++i) {
long long L, R;
cin >> L >> R;
if (R - L + 1 >= T) {
cout << T << '\n';
exit(0);
}
L %= T, R %= T;
if (L <= R) {
events.push_back({L, 1});
events.push_back({R + 1, -1});
} else {
events.push_back({L, 1});
events.push_back({T, -1});
events.push_back({0, 1});
events.push_back({R + 1, -1});
}
}
sort(events.begin(), events.end());
int cur = 0;
long long ans = 0;
for (int i = 0; i + 1 < events.size(); ++i) {
cur += events[i].second;
if (cur != 0) ans += events[i + 1].first - events[i].first;
}
cout << ans;
}
컴파일 시 표준 에러 (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... | ||||
