#include #include typedef struct { int start, end; } pair; pair * create_pair(int a, int b); int main(int argc, char const *argv[]) { int h, g; scanf("%d %d", &h, &g); fprintf(stderr,"%d %d\n", h, g); int * hs = malloc(sizeof(int)*h); for(int i = 0; i< h; i++){ hs[i]=i; } pair *** grooves = malloc(sizeof(pair **)*g); int * idxs = calloc(sizeof(int), g); int idx = 0; for(int i = 0; i< g; i++){ grooves[i] = malloc(sizeof(pair*)*(h/2)); } for(int i = 0; iidx?yp:idx; } for(int i =0; i<=idx; i++){ for(int j = 0 ; j< idxs[i]; j++){ pair * p = grooves[i][j]; int tmp = hs[p->start]; hs[p->start] = hs[p->end]; hs[p->end] = tmp; } } int*res = malloc(sizeof(int)*h); for(int i =0; istart = a; p-> end = b; return p; }