#include #include #include #include #include #include #include void swap(int *xp, int *yp) { int temp = *xp; *xp = *yp; *yp = temp; } // A function to implement bubble sort void bubbleSort(int arr[], int n) { int i, j; for (i = 0; i < n-1; i++) // Last i elements are already in place for (j = 0; j < n-i-1; j++) if (arr[j] > arr[j+1]) swap(&arr[j], &arr[j+1]); } int main(){ int n; scanf("%d",&n); char* *genes = malloc(sizeof(char*) * n); for(int genes_i = 0; genes_i < n; genes_i++){ genes[genes_i] = (char *)malloc(10240 * sizeof(char)); scanf("%s",genes[genes_i]); } int *health = malloc(sizeof(int) * n); for(int health_i = 0; health_i < n; health_i++){ scanf("%d",&health[health_i]); } int s; scanf("%d",&s); int max[s]; for(int a0 = 0; a0 < s; a0++) { max[a0]=0; } for(int a0 = 0; a0 < s; a0++){ int first; int last; int min=0; char* d = (char *)malloc(512000 * sizeof(char)); scanf("%d %d %s",&first,&last,d); int len=strlen(d); for(int i=first;(i<=last&&i