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
set<pair<int, int>> unik;
signed main() {
int n, a, b, l, r, x, y;
cin >> n >> a >> b;
// kpk = lcm(a, b);
// cout << kpk << endl;
for (int i = 0; i < n; i++) {
cin >> l >> r;
for (int j = l; j <= r; j++) {
x = (j + (j/b))%a;
y = j%b;
unik.insert({x, y});
}
}
cout << unik.size() << 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... |