/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: main.c * Author: tym7 * * Created on October 20, 2018, 10:58 AM */ #include #include #include struct Point{ int x; int y; }; /* * */ int main(int argc, char** argv) { int n_guards,n_incidents,distance,s_dist; int in = 0; struct Point *guards,*incidents; in = scanf("%d %d",&n_guards,&n_incidents); guards = calloc(n_guards,sizeof(struct Point)); incidents = calloc(n_incidents,sizeof(struct Point)); for(int i = 0;ix,&(guards+i)->y); } for(int i = 0;ix,&(incidents+i)->y); } //scout = malloc() for(int j = 0;jx; int b = (incidents+j)->y; for(int i = 0;ix == (incidents+j)->x) && ((guards+i)->y == (incidents+j)->y)) { s_dist = 0; break; } int xdif = abs(((guards+i)->x)-a); int ydif = abs(((guards+i)->y)-b); distance = abs(xdif - ydif) + (xdif>ydif?ydif:xdif); if(distance==0){ s_dist = distance; break; } if(distance