mirror of
https://github.com/xlucn/PAT.git
synced 2026-11-05 06:37:35 +08:00
56 lines
6.9 KiB
HTML
56 lines
6.9 KiB
HTML
Decode Registration Card of PAT
|
||
<div class="ques-view"><p>A registration card number of PAT consists of 4 parts:</p>
|
||
<ul>
|
||
<li>the 1st letter represents the test level, namely, <code>T</code> for the top level, <code>A</code> for advance and <code>B</code> for basic;</li>
|
||
<li>the 2nd - 4th digits are the test site number, ranged from 101 to 999;</li>
|
||
<li>the 5th - 10th digits give the test date, in the form of <code>yymmdd</code>;</li>
|
||
<li>finally the 11th - 13th digits are the testee's number, ranged from 000 to 999.</li>
|
||
</ul>
|
||
<p>Now given a set of registration card numbers and the scores of the card owners, you are supposed to output the various statistics according to the given queries.</p>
|
||
<h3 id="input-specification-">Input Specification:</h3>
|
||
<p>Each input file contains one test case. For each case, the first line gives two positive integers <span class="katex"><span class="katex-mathml"><math><mrow><mi>N</mi></mrow>N</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.10903em;">N</span></span></span></span> (<span class="katex"><span class="katex-mathml"><math><mrow><mo>≤</mo><mn>1</mn><msup><mn>0</mn><mn>4</mn></msup></mrow>\le 10^4</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.8141079999999999em;"></span><span class="strut bottom" style="height:0.950078em;vertical-align:-0.13597em;"></span><span class="base textstyle uncramped"><span class="mrel">≤</span><span class="mord mathrm">1</span><span class="mord"><span class="mord mathrm">0</span><span class="msupsub"><span class="vlist"><span style="top:-0.363em;margin-right:0.05em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;"></span></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 style="font-size:0em;"></span></span></span></span></span></span></span></span></span>) and <span class="katex"><span class="katex-mathml"><math><mrow><mi>M</mi></mrow>M</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.10903em;">M</span></span></span></span> (<span class="katex"><span class="katex-mathml"><math><mrow><mo>≤</mo><mn>1</mn><mn>0</mn><mn>0</mn></mrow>\le 100</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.78041em;vertical-align:-0.13597em;"></span><span class="base textstyle uncramped"><span class="mrel">≤</span><span class="mord mathrm">1</span><span class="mord mathrm">0</span><span class="mord mathrm">0</span></span></span></span>), the numbers of cards and the queries, respectively.</p>
|
||
<p>Then <span class="katex"><span class="katex-mathml"><math><mrow><mi>N</mi></mrow>N</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.10903em;">N</span></span></span></span> lines follow, each gives a card number and the owner's score (integer in <span class="katex"><span class="katex-mathml"><math><mrow><mo>[</mo><mn>0</mn><mo separator="true">,</mo><mn>1</mn><mn>0</mn><mn>0</mn><mo>]</mo></mrow>[0, 100]</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mopen">[</span><span class="mord mathrm">0</span><span class="mpunct">,</span><span class="mord mathrm">1</span><span class="mord mathrm">0</span><span class="mord mathrm">0</span><span class="mclose">]</span></span></span></span>), separated by a space.</p>
|
||
<p>After the info of testees, there are <span class="katex"><span class="katex-mathml"><math><mrow><mi>M</mi></mrow>M</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.10903em;">M</span></span></span></span> lines, each gives a query in the format <code>Type Term</code>, where</p>
|
||
<ul>
|
||
<li><code>Type</code> being 1 means to output all the testees on a given level, in non-increasing order of their scores. The corresponding <code>Term</code> will be the letter which specifies the level;</li>
|
||
<li><code>Type</code> being 2 means to output the total number of testees together with their total scores in a given site. The corresponding <code>Term</code> will then be the site number;</li>
|
||
<li><code>Type</code> being 3 means to output the total number of testees of every site for a given test date. The corresponding <code>Term</code> will then be the date, given in the same format as in the registration card.</li>
|
||
</ul>
|
||
<h3 id="output-specification-">Output Specification:</h3>
|
||
<p>For each query, first print in a line <code>Case #: input</code>, where <code>#</code> is the index of the query case, starting from 1; and <code>input</code> is a copy of the corresponding input query. Then output as requested:</p>
|
||
<ul>
|
||
<li>for a type 1 query, the output format is the same as in input, that is, <code>CardNumber Score</code>. If there is a tie of the scores, output in increasing alphabetical order of their card numbers (uniqueness of the card numbers is guaranteed);</li>
|
||
<li>for a type 2 query, output in the format <code>Nt Ns</code> where <code>Nt</code> is the total number of testees and <code>Ns</code> is their total score;</li>
|
||
<li>for a type 3 query, output in the format <code>Site Nt</code> where <code>Site</code> is the site number and <code>Nt</code> is the total number of testees at <code>Site</code>. The output must be in non-increasing order of <code>Nt</code>'s, or in increasing order of site numbers if there is a tie of <code>Nt</code>.</li>
|
||
</ul>
|
||
<p>If the result of a query is empty, simply print <code>NA</code>.</p>
|
||
<h3 id="sample-input-">Sample Input:</h3>
|
||
<pre><code class="lang-in">8 4
|
||
B123180908127 99
|
||
B102180908003 86
|
||
A112180318002 98
|
||
T107150310127 62
|
||
A107180908108 100
|
||
T123180908010 78
|
||
B112160918035 88
|
||
A107180908021 98
|
||
1 A
|
||
2 107
|
||
3 180908
|
||
2 999
|
||
</code></pre>
|
||
<h3 id="sample-output-">Sample Output:</h3>
|
||
<pre><code class="lang-out">Case 1: 1 A
|
||
A107180908108 100
|
||
A107180908021 98
|
||
A112180318002 98
|
||
Case 2: 2 107
|
||
3 260
|
||
Case 3: 3 180908
|
||
107 2
|
||
123 2
|
||
102 1
|
||
Case 4: 2 999
|
||
NA
|
||
</code></pre>
|
||
</div> |