This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import java.util.*;
import java.io.*;
public class strange_device {
public static void main(String[] args) throws IOException
{
Scanner scan = new Scanner(System.in);
PrintWriter out=new PrintWriter(System.out);
long n = scan.nextLong();
long a = scan.nextLong();
long b = scan.nextLong();
Set<String> found = new HashSet<String>();
for (long i = 0; i < n; i++) {
long f = scan.nextLong();
long l = scan.nextLong();
for (long j = f; j <= l; j++) {
String xy = ((j+(j/b))%a)+ "" +(j%b);
//System.out.prlongln("("+x+","+y+")");
found.add(xy);
}
}
out.println(found.size());
out.close();
}
}
# | 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... |