#include #include #include #include #include #include #include using namespace std; //ifstream cin("input.txt", ios::in); //ofstream cout("output.txt", ios::out); string getline(istream &input) { string temp; getline(input,temp); return temp; } class record { private: string mylicense; int mymonth; int mytime; int mytype; int mylocation; void stot (string thetime) { //string to time mymonth=(thetime[0]-'0')*10+(thetime[1]-'0'); int myday=(thetime[3]-'0')*10+(thetime[4]-'0'); int myhour=(thetime[6]-'0')*10+(thetime[7]-'0'); int myminute=(thetime[9]-'0')*10+(thetime[10]-'0'); mytime=(myday*60*24)+(myhour*60)+myminute; } public: record () { mylicense=""; mymonth=0; mytime=0; mytype=-1; mylocation=0; } record (string thelicense, string thetime, string thetype, string thelocation) { mylicense=thelicense; stot(thetime); if (thetype=="enter") mytype=1; else mytype=0; mylocation=0; for (int i=0;(thelocation[i]>='0') && (thelocation[i]<='9');i++) mylocation=mylocation*10+thelocation[i]-'0'; } ~record () { } void update (string thelicense, string thetime, string thetype, string thelocation) { mylicense=thelicense; stot(thetime); if (thetype=="enter") mytype=1; else mytype=0; mylocation=0; for (int i=0;(thelocation[i]>='0') && (thelocation[i]<='9');i++) mylocation=mylocation*10+thelocation[i]-'0'; } string license () { return mylicense; } int month () { return mymonth; } int time () { return mytime; } int type () { return mytype; } int location () { return mylocation; } bool operator< (record b) { if (mymonth myrecords; string mylicense; public: person () { mylicense=""; } person (string license) { mylicense=license; } ~person () { } void update (string license) { mylicense=license; } string license () { return mylicense; } void pushrecord (record newrecord) { myrecords.push_front(newrecord); } int bill (int toll[24]) { int bill=0; myrecords.sort(); record enter, exit; while (!myrecords.empty()) { while (!myrecords.empty() &&myrecords.front().type()!=1) myrecords.pop_front(); enter=myrecords.front(); myrecords.pop_front(); if (!myrecords.empty() && myrecords.front().type()==0) { exit=myrecords.front(); myrecords.pop_front(); // cout << enter.time() << " " << abs(enter.location()-exit.location()) << " " << (enter.time()%1440-enter.time()%60)/60 // << " " << toll[(enter.time()%1440-enter.time()%60)/60] << endl; bill+=100+(toll[(enter.time()%1440-enter.time()%60)/60]* abs(enter.location()-exit.location())); } } if (bill) bill+=200; return bill; } }; int main () { int toll[24]; int cases, numpeople, i, j, bill; string input, license, time, type, location; stringstream iss; person tempperson; record temprecord; bool found; iss.clear(); iss.str(getline(cin)); iss >> cases; iss.clear(); iss.str(getline(cin)); for (i=0; i people; iss.clear(); iss.str(getline(cin)); for (j=0; j<24; j++) iss >> toll[j]; iss.clear(); iss.str(getline(cin)); while (!iss.str().empty()) { iss >> license >> time >> type >> location; //cout << " " << license << " " << time << " " << type << " " << location << endl; temprecord.update(license, time, type, location); found=false; for (j=0; j::iterator tempit=people.begin(); for (j=0; jpeople[j].license(); j++) { tempit++; } people.insert(tempit,tempperson); people[j].pushrecord(temprecord); numpeople++; } iss.clear(); iss.str(getline(cin)); } //cout << numpeople << endl; for (j=0; j