| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 120779 | PeppaPig | Strange Device (APIO19_strange_device) | C++14 | 874 ms | 33412 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define long long long
#define pii pair<long, long>
#define x first
#define y second
using namespace std;
const int N = 1e6+5;
int n;
long A, B, cyc;
vector<pii> v;
int main() {
scanf("%d %lld %lld", &n, &A, &B);
cyc = A / __gcd(B+1, A);
cyc *= B;
for(int i = 1; i <= n; i++) {
long l, r;
scanf("%lld %lld", &l, &r);
l %= cyc, r %= cyc;
v.emplace_back(l, -1);
v.emplace_back(r + 1, 1);
if(l > r) v.emplace_back(0, -1), v.emplace_back(cyc, 1);
}
sort(v.begin(), v.end());
long pv = 0, cnt = 0, ans = 0;
for(int i = 0; i < v.size(); i++) {
if(cnt == 0) pv = v[i].x;
cnt -= v[i].y;
if(cnt == 0) ans += v[i].x - pv;
}
printf("%lld\n", ans);
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... | ||||
