| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 467431 | SirCovidThe19th | 이상한 기계 (APIO19_strange_device) | C++17 | 2033 ms | 100176 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 2e18
int main(){
int n; ll a, b, p; cin >> n >> a >> b; map<ll, int> d;
p = a / __gcd(a, b + 1); p = (p >= inf / b) ? inf : p * b;
for (int i = 0; i < n; i++){
ll l, r; cin >> l >> r;
if (r - l + 1 >= p){ d[0]++, d[p]--; continue; }
l %= p; r %= p;
if (l <= r) d[l]++, d[r + 1]--;
else d[0]++, d[r + 1]--, d[l]++, d[p]--;
}
int cnt = 0; ll pre, ans = 0;
for (auto &val : d){
if (cnt) ans += val.first - pre;
cnt += val.second; pre = val.first;
}
cout<<ans<<endl;
}
| # | 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... | ||||
