Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by пп ( 15 years ago )
#include<stdio.h>
#include<vector>;
#include<stdlib.h>
using namespace std;

struct time
{
 int min;
 bool open;
 int operator -(time& x)
 {
  return min- x.min -(int)open +(int)x.open;
 }
};
int cmp(const void *a, const void *b) {

     return *(time*)a - *(time*)b;
 }
time otr[600000];
int line[600000];
int main()
{
 freopen("input.txt","r",stdin);
 freopen("output.txt","w",stdout);
 int strok;
 int inter;
 int d,m,h,mn;
 int n=0;
 time t1;
 scanf("%d",&strok;);
 for(int i=0;i< strok;i++)
 {
  scanf("%d",&inter;);
  for(int j=0;j<inter;j++)
  {
   scanf("%d%d%d%d",&m,&d,&h,&mn;);
   int p = (((m-1)*30 + d-1)* 24 + h)*60 +mn;
   t1.min=p;
   t1.open=true;
   otr[n]=t1;
   n++;
   scanf("%d%d%d%d",&m,&d,&h,&mn;);
    p = (((m-1)*30 + d-1)* 24 + h)*60 +mn;
   t1.min=p;
   t1.open=false;
   otr[n]=t1;
   n++;
  }
 }
 qsort(otr,n ,sizeof(time),cmp);
 int curt=0;
 int cur=0;
 int max=0;;
 for(int i=0;i<n;i++)
 {
  if(otr[i].open==true)
    {
     cur++;
   if(cur>max)
   {
    max=cur;
    curt=otr[i].min;
   }

  }
  else
   cur--;

 }
 m= curt/(30*24*60) +1;
 curt%=(30*24*60);
 d= curt/(24*60) +1;
 curt%= (24*60);
 h= curt/(60);
 mn= curt`;

 printf("%d %d %d %d %d \n", max , m ,d ,h ,mn);
}

 

Revise this Paste

Your Name: Code Language: