5 #define SWAP(x, y) { x ^= y; y ^= x; x ^= y; }
7 struct point
{ int x
; int y
; };
8 struct entry
{ struct point key
; int i
; UT_hash_handle hh
; };
10 void mark_point(int x
, int y
, struct entry
**entries
, int *r
)
14 memset(&s
, 0, sizeof s
);
17 HASH_FIND(hh
, *entries
, &s
, sizeof(struct point
), p
);
22 p
= calloc(1, sizeof(struct entry
));
25 HASH_ADD(hh
, *entries
, key
, sizeof(struct point
), p
);
32 struct entry
*entries
= NULL
;
34 while (fgets(buf
, 1000, stdin
) != NULL
) {
36 int x1
= strtol(ptr
, &ptr
, 10);
38 int y1
= strtol(ptr
, &ptr
, 10);
40 int x2
= strtol(ptr
, &ptr
, 10);
42 int y2
= strtol(ptr
, &ptr
, 10);
50 for (int y
= y1
; y
<=y2
; y
++)
51 mark_point(x1
, y
, &entries
, &r
);
54 for (int x
= x1
; x
<=x2
; x
++)
55 mark_point(x
, y1
, &entries
, &r
);