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 std::cin, std::cout, std::vector, std::set, std::endl, std::string, std::map,std::pair;
#ifdef LOCAL
#define file freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
#else
#define file ;;
#endif
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T>
using Tree = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#include <random>
int main(){
file;
int n,A,B;
cin >> n >> A >> B;
vector<int> l(n),r(n);
set<pair<int,int>> s;
for(int i=0;i<n;i++){
cin >> l[i] >> r[i];
for(int t=l[i];t<=r[i];t++){
s.insert({(t+t/B)%A,t%B});
}
}
cout << s.size() << endl;
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... |