Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
841 B
0
Indexable
Never
#include<stdio.h>
#include<stdlib.h>

struct task{
    char task_name;
    int start;
    int finish;
};
struct task user[50];


void Maximum_activity(int s[], int f[], int n, struct task arr[])
{
    int i, j;
    i = 0;
    printf("%d ", i);

    for (j = 1; j < n; j++)
    {
      if (s[j] >= f[i])
      {
          printf ("%c \n", arr[j].task_name);
          i = j;
      }
    }
}

int main()
{
    int num, start[50], finish[50], b_time;
    scanf("%d", &num);

    for(int i=0; i<num; i++)
    {
        scanf("%c", &user[i].task_name);
        scanf("%d%d", &user[i].start, &user[i].finish);
    }

    scanf("%d", &b_time);

    for(int i=0; i<num; i++)
    {
        start[i]=user[i].start;
        finish[i]=user[i].finish;
    }

    Maximum_activity(start,finish,num,user);
}