In order to fight the menacing COVID19 new coronavirus, development throughout the country have launched various measures to contain the outbreak, one of the important link is the issuance of masks,
Because of the need for reserving them for the public city, citizens launched a small program to fill in information, convenient work, small program is a collection of all kinds of information, including the names of the citizens, id, physical condition, submit a time and so on, but because the data volume is too big, need according to certain rules to filter and process, please write a program, in accordance with the rules of a given output masks send list,
Input format:
Enter the first line is two positive integers D and P (1 D or less, P 30) or less, said D day data, citizens will need at least two masks in a time interval P day,
D next block of data, each gives the application information of one day, the first block of data (I=1,? D) is the first line of the two integers T? I
And S? I (1 T or less? I, Si 1000 or less), said in the first day I have Ti application, there are places in masks to issue Si, then Ti rows, each row is given a application information, format is as follows:
Name and id number submitted time physical condition
Given data constraints are as follows:
Name is a length of not more than 10 non-empty string does not contain Spaces;
Id number is a non-empty string length no more than 20;
Physical condition is 0 or 1, 0 said good, consciously 1 said related symptoms;
Submission time is hh: mm, for 24 hours (from 00:00 to 23:59, 09:08, for example), note that the deadline of the given record not orderly;
Id number is different, the same id number is considered to be the same person, id data to ensure the same name is the same,
Can record requirements of reserving them as follows:
Identification number must be 18 digital (can include leading 0);
If the same id number on the first day I application is successful, then the next day P can't apply for again, that is to say, if the day the application is successful, I will wait for the I + P + 1 days to apply for again;
In the above two meet the conditions, in accordance with the submitted time order issued, until all records have been processed or S? Quota of I was exhausted, if submit the same time, according to the order of appear in the list of decision,
The output format:
For application to record every day, each output a get a mask of person's name and id number, separated by a space, the order in accordance with the order,
In the output after the issue record, you also need to output have legal records, physical condition is one of the applicant's name and id number, separated by a space, order according to the application for record in order to determine, the same person only need to output a,
Input the sample:
4 2
5 3
A 123456789012345670 1 13:58
B, 123456789012345671 13:58
C 12345678901234567 and
D 123456789012345672 03:24
C 123456789012345673 0 to pronounce
4 3
A 123456789012345670 1 13:58
E 123456789012345674 0 to pronounce
C 123456789012345673 0 to pronounce
F 0 F 14:00
1 3
E 123456789012345674 1 13:58
1 1
A 123456789012345670 0 when
The output sample:
D 123456789012345672
A 123456789012345670
B 123456789012345671
E 123456789012345674
C 123456789012345673
A 123456789012345670
A 123456789012345670
E 123456789012345674
Sample:
Output, the first line to the third line is the first day of the part; Fourth, the five elements is the second part of the day; On the third day did not conform to the requirements of citizens; Line 6 is part of the fourth day, the last two lines appear in accordance with the order the possible discomfort,
The author
DAI, Longao
Hangzhou hundred teng education technology co., LTD.
The code length limit
16 KB
Time limit
400 ms
Memory limit
64 MB
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
I wrote a few, it seems that liver did not move into a dead end for bosses to help see
#include
#include
Struct people//the contents of each application structure
{
Char name [11].
Char id [20];
Int the health;
Char time [6]. ://* * * * time using the time instead of a string format, in to the total minutes t
Int hh, mm;
Int t;
int p; Masks,//p to identify whether received receipt into p, says another p days to receive the mask
};
Struct day//content structure contains a day days D days between P and application (people type structure) constitute an array of
{
Int T;
Int S;//T for the application number, S for masks for
Struct people a, [1000].
};
Struct people change (struct people s)//this function with the input and o t (people in structure to the total minutes) function;
{
The scanf (" % d % s % s % s ", & amp; S.n ame, & amp; S.i d, & amp; Sheldon horowitz ealth, & amp; S.t ime);
Sheldon horowitz h=(s.t ime [0] - '0') * 10 + s.t ime [1] - '0'.
S.m m=(s.t ime [3] - '0') * 10 + s.t ime [4] - '0'.
Sheldon horowitz at s.t=h * 60 + s.m m;
Return s;
}
Struct day oneday (int I, struct day * pa)//the first day I apply for and masks for input
{
The scanf (" % d % d ", & amp; ((pa + I) - & gt; T), & amp; ((pa + I) - & gt; S));
for(int j=0; j<(pa + I) - & gt; T; J++)
(pa + I) - & gt; A [j]=change ((pa + I) - & gt; A [j]);
Return * (pa + I);
}
Struct day handle (int, c struct day pb [])//the daily data to
{
Struct people t, k;
int i,j;
for(i=0; i
{
T=pb [c] a [j + 1);
Pb [c] a [j + 1)=pb [c] a [j];
Pb [c] a [j]=t;
}
Return pb [c];
}
Int D, P;//the total number of days D, and interval number P global variable
Int main ()
{
Struct day d [10];
The scanf (" % d % d ", & amp; D, & amp; P);
int i,j,t;//loop with code, remember digital
for(i=0; i
//for (I=0; i
//printf (" \ n ");//...
//}//inspection statement to complete the input of D day, every article T application, the information contained in people apply for the
//processing distribution mask.
for(i=0; i
//for (I=0; i
//printf (" \ n "); }//see if sorting result correct
//select output
for(i=0; i
{printf (" % s % s \ n ", d [I] a [j]. Name, d [I] a [j]. Id);
D [I] a [j]. J p=p;
}
}//output the answer have problems
for(i=0; i
Printf (" % s % s \ n ", d [I] a [j]. Name, d [I] a [j]. Id);
return 0;
}