fork download
  1. #include <stdio.h>
  2. #include <cstring>
  3. int main(){
  4. int n, x1, y1, x2, y2, ans[101];
  5. int paper[102][102];
  6. memset(paper, -1, 102*102*sizeof(int));
  7. scanf("%d", &n);
  8. for(int num=0; num<n; num++){
  9. scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
  10. for(int i=x1; i<x1+x2; i++){
  11. for(int j=y1; j<y1+y2; j++){
  12. if(paper[i][j]==-1){
  13. ans[num]++;
  14. paper[i][j]=num;
  15. }
  16. else{
  17. ans[paper[i][j]]--;
  18. ans[num]++;
  19. paper[i][j]=num;
  20. }
  21. }
  22. }
  23. }
  24. for(int num=0; num<n; num++)
  25. printf("%d\n", ans[num]);
  26. }
Success #stdin #stdout 0s 3144KB
stdin
4
0 0 3 2
0 3 3 2
2 0 3 2
2 3 3 2
stdout
4
4
6
6