import java.util.*;
import java.io.*;
public class strange_device {
public static void main(String[] args)
{
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+(int)Math.floor(j/b))%a)+ "" +( j % b);
//System.out.println("("+x+","+y+")");
found.add(xy);
}
}
out.println(found.size());
out.close();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
119 ms |
10932 KB |
Output is correct |
2 |
Runtime error |
125 ms |
11036 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
121 ms |
10920 KB |
Output is correct |
2 |
Runtime error |
133 ms |
11232 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
124 ms |
10984 KB |
Output is correct |
2 |
Runtime error |
130 ms |
11108 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
134 ms |
11000 KB |
Output is correct |
2 |
Runtime error |
132 ms |
11120 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
134 ms |
11000 KB |
Output is correct |
2 |
Runtime error |
132 ms |
11120 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
134 ms |
11000 KB |
Output is correct |
2 |
Runtime error |
132 ms |
11120 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
125 ms |
10876 KB |
Output is correct |
2 |
Runtime error |
128 ms |
11048 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
119 ms |
10932 KB |
Output is correct |
2 |
Runtime error |
125 ms |
11036 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |