fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.util.Arrays.*;
  4.  
  5.  
  6. class Main
  7. {
  8. public static void main (String[] args)
  9. {
  10. int a = 0, b = 0;
  11. Scanner input = new Scanner(System.in);
  12. int x_max = input.nextInt();
  13. int y_max = input.nextInt();
  14. int n = input.nextInt();
  15. int x[] = new int[n+2];
  16. int y[] = new int[n+2];
  17. for(int i = 1; i < n + 1; i++)
  18. {
  19. x[i] = input.nextInt();
  20. y[i] = input.nextInt();
  21. }
  22. x[0] = y[0] = 0;
  23. x[n + 1] = x_max + 1;
  24. y[n + 1] = y_max + 1;
  25. Arrays.sort(x);
  26. Arrays.sort(y);
  27. for(int i = 0; i < n + 1; i++)
  28. {
  29. if(x[i + 1]-x[i]>a) a = x[i + 1]-x[i];
  30. if(y[i + 1]-y[i]>b) b = y[i + 1]-y[i];
  31. }
  32. System.out.print((a-1)*(b-1));
  33. }
  34. }
Success #stdin #stdout 0.06s 2184192KB
stdin
10 10 3
1 1
2 2
3 3
stdout
49