4 #define SWAP(x, y) { x ^= y; y ^= x; x ^= y; }
6 struct point
{ int x
; int y
; };
7 struct entry
{ struct point key
; int i
; UT_hash_handle hh
; };
9 void mark_point(int x
, int y
, struct entry
**entries
, int *r
)
12 struct point s
= { .x
=x
, .y
=y
};
13 HASH_FIND(hh
, *entries
, &s
, sizeof(struct point
), p
);
18 p
= malloc(sizeof(struct entry
));
21 HASH_ADD(hh
, *entries
, key
, sizeof(struct point
), p
);
28 struct entry
*entries
= NULL
;
30 while (fgets(buf
, 1000, stdin
) != NULL
) {
32 int x1
= strtol(ptr
, &ptr
, 10);
34 int y1
= strtol(ptr
, &ptr
, 10);
36 int x2
= strtol(ptr
, &ptr
, 10);
38 int y2
= strtol(ptr
, &ptr
, 10);
46 for (int y
= y1
; y
<=y2
; y
++)
47 mark_point(x1
, y
, &entries
, &r
);
50 for (int x
= x1
; x
<=x2
; x
++)
51 mark_point(x
, y1
, &entries
, &r
);