| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 333138 | qwe854896 | 이상한 기계 (APIO19_strange_device) | C++14 | 842 ms | 82256 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define X first
#define Y second
using namespace std;
map <int, int> m;
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n, A, B;
cin >> n >> A >> B;
int ans = 0, MOD = log10(A) - log10(__gcd(A, B+1)) + log10(B) > 18 ? (long long)(1e18+1) : A / __gcd(A, B+1) * B;
while (n--) {
int l, r;
cin >> l >> r;
int L = l % MOD, R = r % MOD;
if (L < R) m[L]++, m[R+1]--;
else if (L > R) m[L]++, m[MOD]--, m[0]++, m[R+1]--;
else if (l == r) m[L]++, m[L+1]--;
else ans = MOD;
}
int sum = 0, f = 1, l;
if (ans != MOD) {
for (auto seg:m) {
//cout << seg.X << ' ' << seg.Y << endl;
sum += seg.Y;
if (sum and f) l = seg.X, f = 0;
else if (!sum) ans += seg.X - l, f = 1;
}
}
cout << ans << endl;
return 0;
}컴파일 시 표준 에러 (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... | ||||
