#include <stdio.h>
-#include <stdbool.h>
#include <uthash.h>
*(to++)= '\0';
add_dot(&grid, pnt(atoi(buf), atoi(to)));
}
- while (getline(&buf, &len, stdin) != -1) {
- char *to = strchr(buf, '=');
- fold (&grid, *(to-1), atoi(to+1));
- }
int maxx = 0, maxy = 0;
- for (struct dot *d = grid; d!=NULL; d = d->hh.next) {
- maxx = maxx < d->p.x ? d->p.x : maxx;
- maxy = maxy < d->p.y ? d->p.y : maxy;
+ while (getline(&buf, &len, stdin) != -1) {
+ char *to = strchr(buf, '=')-1;
+ int foldline = atoi(to+2);
+ fold (&grid, *to, foldline--);
+ if (*to == 'x') maxx = foldline;
+ else maxy = foldline;
}
struct dot *d;