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);
int n = scan.nextInt();
int a = scan.nextInt();
int b = scan.nextInt();
Set<String> found = new HashSet<String>();
for (int i = 0; i < n; i++) {
int f = scan.nextInt();
int l = scan.nextInt();
for (int j = f; j <= l; j++) {
String xy = ((j+(j/b))%a)+ "" +(j%b);
//System.out.println("("+x+","+y+")");
found.add(xy);
}
}
out.println(found.size());
scan.close();
out.close();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
135 ms |
10992 KB |
Output is correct |
2 |
Runtime error |
122 ms |
10900 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
120 ms |
10932 KB |
Output is correct |
2 |
Runtime error |
124 ms |
11036 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
123 ms |
10844 KB |
Output is correct |
2 |
Runtime error |
127 ms |
10996 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
126 ms |
10940 KB |
Output is correct |
2 |
Runtime error |
124 ms |
11208 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
126 ms |
10940 KB |
Output is correct |
2 |
Runtime error |
124 ms |
11208 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
126 ms |
10940 KB |
Output is correct |
2 |
Runtime error |
124 ms |
11208 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
121 ms |
10992 KB |
Output is correct |
2 |
Runtime error |
129 ms |
10916 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
135 ms |
10992 KB |
Output is correct |
2 |
Runtime error |
122 ms |
10900 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |