This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6 + 5;
int l[N], r[N], mark[N];
int32_t main() {
int n, A, B, ans = 0; cin >> n >> A >> B;
A = A / __gcd(A, B + 1);
for (int i = 0; i < n; i++) {
cin >> l[i] >> r[i];
for (int j = l[i]; j <= r[i]; j++) if (!mark[j%(A*B)]) mark[j%(A*B)] = 1, ans++;
}
cout << ans << "\n";
return 0;
}
# | 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... |