| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 135153 | jhnah917 | 이상한 기계 (APIO19_strange_device) | C++14 | 702 ms | 18500 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
ll n, a, b, c, sz;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> a >> b;
sz = a / __gcd(a, b+1) * b;
vector<p> v;
for(int i=0; i<n; i++){
ll l, r; cin >> l >> r;
if(r-l+1 > sz){
cout << sz; return 0;
}
l %= sz, r %= sz;
if(l <= r) v.emplace_back(l, r);
else v.emplace_back(l, sz-1), v.emplace_back(0, r);
}
sort(v.begin(), v.end());
ll ans = 0;
for(int i=0; i<v.size(); i++){
int j = i; ll now = v[i].second;
while(j < v.size() && v[j].first <= now){
now = max(now, v[j].second); j++;
}
ans += now - v[i].first + 1;
i = j - 1;
}
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... | ||||
