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();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
121 ms |
11012 KB |
Output is correct |
2 |
Incorrect |
817 ms |
67272 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
121 ms |
11032 KB |
Output is correct |
2 |
Execution timed out |
5075 ms |
294344 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
130 ms |
11484 KB |
Output is correct |
2 |
Incorrect |
900 ms |
83916 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
120 ms |
10976 KB |
Output is correct |
2 |
Execution timed out |
5108 ms |
401712 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
120 ms |
10976 KB |
Output is correct |
2 |
Execution timed out |
5108 ms |
401712 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
120 ms |
10976 KB |
Output is correct |
2 |
Execution timed out |
5108 ms |
401712 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
120 ms |
10876 KB |
Output is correct |
2 |
Execution timed out |
5028 ms |
239576 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
121 ms |
11012 KB |
Output is correct |
2 |
Incorrect |
817 ms |
67272 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |