{"id":788,"date":"2019-09-25T15:24:33","date_gmt":"2019-09-25T07:24:33","guid":{"rendered":"http:\/\/149.129.74.185\/?p=788"},"modified":"2019-09-25T15:24:33","modified_gmt":"2019-09-25T07:24:33","slug":"patadvanced1095-cars-on-campus-30-%e5%88%86","status":"publish","type":"post","link":"http:\/\/www.magicmipamipa.com\/?p=788","title":{"rendered":"PAT(Advanced)1095 Cars on Campus (30 \u5206)"},"content":{"rendered":"<h2 style=\"text-align: center;\" id=\"mcetoc_1dlji8qtu0\"><span>1095<\/span><span>\u00a0<\/span><span>Cars on Campus<\/span><span>\u00a0<\/span><span>(30\u00a0<\/span><span>\u5206<\/span><span>)<\/span><\/h2>\n<p>Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in\/out times and the plate numbers of the cars crossing the gate. Now with all the information available, you are supposed to tell, at any specific time point, the number of cars parking on campus, and at the end of the day find the cars that have parked for the longest time period.<\/p>\n<h3 id=\"input-specification-\">Input Specification:<\/h3>\n<p>Each input file contains one test case. Each case starts with two positive integers<span>\u00a0<\/span><span class=\"katex\"><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"strut\"><\/span><span class=\"strut bottom\"><\/span><span class=\"base textstyle uncramped\"><span class=\"mord mathit\">N<\/span><\/span><\/span><\/span><span>\u00a0<\/span>(<span class=\"katex\"><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"strut\"><\/span><span class=\"strut bottom\"><\/span><span class=\"base textstyle uncramped\"><span class=\"mrel\">\u2264<\/span><span class=\"mord mathrm\">1<\/span><span class=\"mord\"><span class=\"mord mathrm\">0<\/span><span class=\"msupsub\"><span class=\"vlist\"><span><span class=\"fontsize-ensurer reset-size5 size5\">\u200b<\/span><span class=\"reset-textstyle scriptstyle uncramped mtight\"><span class=\"mord mathrm mtight\">4<\/span><\/span><\/span><span class=\"baseline-fix\"><span class=\"fontsize-ensurer reset-size5 size5\"><span>\u200b<\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span>), the number of records, and<span>\u00a0<\/span><span class=\"katex\"><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"strut\"><\/span><span class=\"strut bottom\"><\/span><span class=\"base textstyle uncramped\"><span class=\"mord mathit\">K<\/span><\/span><\/span><\/span><span>\u00a0<\/span>(<span class=\"katex\"><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"strut\"><\/span><span class=\"strut bottom\"><\/span><span class=\"base textstyle uncramped\"><span class=\"mrel\">\u2264<\/span><span class=\"mord mathrm\">8<\/span><span class=\"mbin\">\u00d7<\/span><span class=\"mord mathrm\">1<\/span><span class=\"mord\"><span class=\"mord mathrm\">0<\/span><span class=\"msupsub\"><span class=\"vlist\"><span><span class=\"fontsize-ensurer reset-size5 size5\">\u200b<\/span><span class=\"reset-textstyle scriptstyle uncramped mtight\"><span class=\"mord mathrm mtight\">4<\/span><\/span><\/span><span class=\"baseline-fix\"><span class=\"fontsize-ensurer reset-size5 size5\"><span>\u200b<\/span><\/span>\u200b<\/span><\/span><\/span><\/span><\/span><\/span><\/span>) the number of queries. Then<span>\u00a0<\/span><span class=\"katex\"><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"strut\"><\/span><span class=\"strut bottom\"><\/span><span class=\"base textstyle uncramped\"><span class=\"mord mathit\">N<\/span><\/span><\/span><\/span><span>\u00a0<\/span>lines follow, each gives a record in the format:<\/p>\n<pre><code>plate_number hh:mm:ss status\r\n<\/code><\/pre>\n<p>where<span>\u00a0<\/span><code>plate_number<\/code><span>\u00a0<\/span>is a string of 7 English capital letters or 1-digit numbers;<span>\u00a0<\/span><code>hh:mm:ss<\/code><span>\u00a0<\/span>represents the time point in a day by hour:minute:second, with the earliest time being<span>\u00a0<\/span><code>00:00:00<\/code><span>\u00a0<\/span>and the latest<span>\u00a0<\/span><code>23:59:59<\/code>; and<span>\u00a0<\/span><code>status<\/code><span>\u00a0<\/span>is either<span>\u00a0<\/span><code>in<\/code><span>\u00a0<\/span>or<span>\u00a0<\/span><code>out<\/code>.<\/p>\n<p>Note that all times will be within a single day. Each<span>\u00a0<\/span><code>in<\/code><span>\u00a0<\/span>record is paired with the chronologically next record for the same car provided it is an<span>\u00a0<\/span><code>out<\/code><span>\u00a0<\/span>record. Any<span>\u00a0<\/span><code>in<\/code><span>\u00a0<\/span>records that are not paired with an<span>\u00a0<\/span><code>out<\/code><span>\u00a0<\/span>record are ignored, as are<span>\u00a0<\/span><code>out<\/code><span>\u00a0<\/span>records not paired with an<span>\u00a0<\/span><code>in<\/code><span>\u00a0<\/span>record. It is guaranteed that at least one car is well paired in the input, and no car is both<span>\u00a0<\/span><code>in<\/code><span>\u00a0<\/span>and<span>\u00a0<\/span><code>out<\/code><span>\u00a0<\/span>at the same moment. Times are recorded using a 24-hour clock.<\/p>\n<p>Then<span>\u00a0<\/span><span class=\"katex\"><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"strut\"><\/span><span class=\"strut bottom\"><\/span><span class=\"base textstyle uncramped\"><span class=\"mord mathit\">K<\/span><\/span><\/span><\/span><span>\u00a0<\/span>lines of queries follow, each gives a time point in the format<span>\u00a0<\/span><code>hh:mm:ss<\/code>. Note: the queries are given in<span>\u00a0<\/span><strong>ascending<\/strong><span>\u00a0<\/span>order of the times.<\/p>\n<h3 id=\"output-specification-\">Output Specification:<\/h3>\n<p>For each query, output in a line the total number of cars parking on campus. The last line of output is supposed to give the plate number of the car that has parked for the longest time period, and the corresponding time length. If such a car is not unique, then output all of their plate numbers in a line in alphabetical order, separated by a space.<\/p>\n<h3 id=\"sample-input-\">Sample Input:<\/h3>\n<pre><code class=\"lang-in\">16 7\r\nJH007BD 18:00:01 in\r\nZD00001 11:30:08 out\r\nDB8888A 13:00:00 out\r\nZA3Q625 23:59:50 out\r\nZA133CH 10:23:00 in\r\nZD00001 04:09:59 in\r\nJH007BD 05:09:59 in\r\nZA3Q625 11:42:01 out\r\nJH007BD 05:10:33 in\r\nZA3Q625 06:30:50 in\r\nJH007BD 12:23:42 out\r\nZA3Q625 23:55:00 in\r\nJH007BD 12:24:23 out\r\nZA133CH 17:11:22 out\r\nJH007BD 18:07:01 out\r\nDB8888A 06:30:50 in\r\n05:10:00\r\n06:30:50\r\n11:00:00\r\n12:23:42\r\n14:00:00\r\n18:00:00\r\n23:59:00\r\n<\/code><\/pre>\n<h3 id=\"sample-output-\">Sample Output:<\/h3>\n<pre><code class=\"lang-out\">1\r\n4\r\n5\r\n2\r\n1\r\n0\r\n1\r\nJH007BD ZD00001 07:20:09<\/code><\/pre>\n<p>\u9898\u76ee\u89e3\u8bfb\uff1a\u7ed9\u51fa\u505c\u8f66\u573a\u7684\u8fdb\u51fa\u7684\u5217\u8868\uff0c\u6c42\u5728\u8fd9\u4e2a\u65f6\u95f4\u6bb5\u6709\u591a\u5c11\u8f66\uff0c\u4ee5\u53ca\u5728\u505c\u8f66\u573a\u5446\u6700\u4e45\u7684\u8f66\u724c\u53f7\u53ca\u65f6\u95f4\u3002<\/p>\n<p>\u89e3\u9898\u601d\u8def\uff1a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1095\u00a0Cars on Campus\u00a0(30\u00a0\u5206) Zhejiang University has [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,18,17],"tags":[],"_links":{"self":[{"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/posts\/788"}],"collection":[{"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=788"}],"version-history":[{"count":1,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/posts\/788\/revisions"}],"predecessor-version":[{"id":789,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/posts\/788\/revisions\/789"}],"wp:attachment":[{"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=788"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}