Submission #124462

# Submission time Handle Problem Language Result Execution time Memory
124462 2019-07-03T11:17:02 Z KhalilBenGamra Strange Device (APIO19_strange_device) Java 11
0 / 100
125 ms 11164 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();
		 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();
		 System.exit(0);
	 }
}
# Verdict Execution time Memory Grader output
1 Correct 119 ms 10908 KB Output is correct
2 Runtime error 125 ms 11108 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 120 ms 11000 KB Output is correct
2 Runtime error 121 ms 10988 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 116 ms 11016 KB Output is correct
2 Runtime error 116 ms 11068 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 120 ms 11060 KB Output is correct
2 Runtime error 124 ms 10948 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 120 ms 11060 KB Output is correct
2 Runtime error 124 ms 10948 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 120 ms 11060 KB Output is correct
2 Runtime error 124 ms 10948 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 120 ms 11164 KB Output is correct
2 Runtime error 122 ms 10956 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 119 ms 10908 KB Output is correct
2 Runtime error 125 ms 11108 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -