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();
int count = 0;
boolean [][] found = new boolean[100000][100000];
for (int i = 0; i < n; i++) {
int f = scan.nextInt();
int l = scan.nextInt();
for (int j = f; j <= l; j++) {
int x = ((j+(int)Math.floor(j/b))%a);
int y = j % b;
//System.out.println("("+x+","+y+")");
if(!found[x][y]){
count ++;
found[x][y] = true ;
}
}
}
out.println(count);
out.close();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
858 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
816 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
852 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
892 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
892 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
892 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
915 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
858 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |