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;
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;i<=r;i++) s.emplace(i%mod);
}
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... |