Submission #124408

# Submission time Handle Problem Language Result Execution time Memory
124408 2019-07-03T09:50:24 Z KhalilBenGamra Strange Device (APIO19_strange_device) Java 11
0 / 100
915 ms 524288 KB
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();
	 }
}
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -