| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1368749 | dl2718281 | 이상한 기계 (APIO19_strange_device) | C++20 | 798 ms | 16840 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n,a,b;
cin >> n >> a >> b;
long long m;
if (b > 1000000000000000005/a) {
m = 1000000000000000005;
}
else {
m = a*b;
}
vector<pair<long long,long long>> v;
for (long long i = 0; i < n; i++) {
long long l,r;
cin >> l >> r;
if (r-l >= m) {
cout << m;
return 0;
}
l %= m;
r %= m;
if (l > r) {
v.push_back({0,r});
v.push_back({l,m-1});
}
else {
v.push_back({l,r});
}
}
sort(v.begin(),v.end());
long long r = -1;
long long ans = 0;
for (auto i:v) {
ans += max((long long)0,i.second-max(r+1,i.first)+1);
r = max(r,i.second);
}
cout << ans;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
