fork(1) download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6. int x_max, y_max, n, a=0, b=0;
  7. cin>>x_max>>y_max>>n;
  8. int *x=new int[n+2];
  9. int *y=new int[n+2];
  10. for(int i=1;i<n+1;i++)
  11. cin>>x[i]>>y[i];
  12. x[0] = y[0] = 0;
  13. x[n+1] = x_max + 1;
  14. y[n+1] = y_max + 1;
  15. sort(x, x + n+1);
  16. sort(y, y + n+1);
  17. for(int i=0; i<n+1; i++){
  18. if(x[i+1]-x[i]>a) a=x[i+1]-x[i];
  19. if(y[i+1]-y[i]>b) b=y[i+1]-y[i];
  20. }
  21. cout<<(a-1)*(b-1);
  22. return 0;
  23. }
Success #stdin #stdout 0s 4204KB
stdin
10 10 3
1 1
2 2
3 3
stdout
49