| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 392246 | BartolM | 이상한 기계 (APIO19_strange_device) | C++17 | 605 ms | 53508 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#define DEBUG 1
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, pii> pip;
typedef pair <pii, int> ppi;
typedef pair <ll, ll> pll;
const int INF=0x3f3f3f3f;
const ll MAX=1e18+2;
int n, fl=0;
ll A, B, gc;
vector <pll> v;
int main() {
scanf("%d %lld %lld", &n, &A, &B);
gc=__gcd(A, B+1);
ll block=A/gc*B;
if (A/gc>MAX/B) block=MAX;
for (int i=0; i<n; ++i) {
ll l, r;
scanf("%lld %lld", &l, &r);
if (r-l+1>block) fl=1;
l%=block; r%=block;
if (l<=r) v.pb(mp(l, r));
else v.pb(mp(l, block-1)), v.pb(mp(0, r));
}
if (fl) {
printf("%lld\n", block);
return 0;
}
sort(v.begin(), v.end());
ll lef=-1, rig=-2, sol=0;
for (pll pp:v) {
if (rig<pp.X) sol+=rig-lef+1, rig=pp.Y, lef=pp.X;
else rig=max(rig, pp.Y);
}
sol+=rig-lef+1;
printf("%lld\n", sol);
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... | ||||
