Skip to content

Instantly share code, notes, and snippets.

@Eric-Bro
Created October 18, 2012 14:08
Show Gist options
  • Save Eric-Bro/3912064 to your computer and use it in GitHub Desktop.
Save Eric-Bro/3912064 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {
int x=0, y=0, count=0, users=0;
int max=0;
scanf("%d%d", &count, &users);
--count;
int *stages = malloc(sizeof(*stages) * count);
memset(stages, 0, count);
for (int i=0; i < users; i++) {
char tmp1[20], tmp2[20];
scanf("%s%s%d%d", &tmp1, &tmp2, &x, &y);
--y; --x;
for (int k = x; k < y; k++) {
stages[k] += 1;
max = (stages[k] > max) ? stages[k] : max;
}
}
for (int i=0; i < count; i++) {
if (stages[i] == max) {
printf("%d-%d\n", i+1, i+2);
}
}
free(stages);
return (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment