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;
int n;
long long a, b, mod;
long long l, r, last=0, sum = 0;
unordered_set<long long> s;
int main() {
cin.tie(0) -> sync_with_stdio(0);
cin >> n >> a >> b;
if(a >= 4e18/b) mod = 4e18;
else mod = a*b;
while(n--) {
cin >> l >> r;
for(int i=l,ct=l%mod;i<=r;i++,ct=(ct==mod-1?0:ct+1)) s.emplace(ct);
}
cout << s.size();
}
# | 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... |