mirror of
https://github.com/xlucn/PAT.git
synced 2026-11-04 00:38:13 +08:00
71 lines
5.6 KiB
HTML
71 lines
5.6 KiB
HTML
Digital Library
|
||
<div class="ques-view"><p>A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number as its ID. Given any query from a reader, you are supposed to output the resulting books, sorted in increasing order of their ID's.</p>
|
||
<h3 id="input-specification-">Input Specification:</h3>
|
||
<p>Each input file contains one test case. For each case, the first line contains a positive integer <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>) which is the total number of books. 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> blocks follow, each contains the information of a book in 6 lines:</p>
|
||
<ul>
|
||
<li>Line #1: the 7-digit ID number;</li>
|
||
<li>Line #2: the book title -- a string of no more than 80 characters;</li>
|
||
<li>Line #3: the author -- a string of no more than 80 characters;</li>
|
||
<li>Line #4: the key words -- each word is a string of no more than 10 characters without any white space, and the keywords are separated by exactly one space;</li>
|
||
<li>Line #5: the publisher -- a string of no more than 80 characters;</li>
|
||
<li>Line #6: the published year -- a 4-digit number which is in the range [1000, 3000].</li>
|
||
</ul>
|
||
<p>It is assumed that each book belongs to one author only, and contains no more than 5 key words; there are no more than 1000 distinct key words in total; and there are no more than 1000 distinct publishers.</p>
|
||
<p>After the book information, there is a line containing a positive integer <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><mn>0</mn></mrow>\le 1000</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 class="mord mathrm">0</span></span></span></span>) which is the number of user's search queries. Then <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 follow, each in one of the formats shown below:</p>
|
||
<ul>
|
||
<li>1: a book title</li>
|
||
<li>2: name of an author</li>
|
||
<li>3: a key word</li>
|
||
<li>4: name of a publisher</li>
|
||
<li>5: a 4-digit number representing the year</li>
|
||
</ul>
|
||
<h3 id="output-specification-">Output Specification:</h3>
|
||
<p>For each query, first print the original query in a line, then output the resulting book ID's in increasing order, each occupying a line. If no book is found, print <code>Not Found</code> instead.</p>
|
||
<h3 id="sample-input-">Sample Input:</h3>
|
||
<pre><code class="lang-in">3
|
||
1111111
|
||
The Testing Book
|
||
Yue Chen
|
||
test code debug sort keywords
|
||
ZUCS Print
|
||
2011
|
||
3333333
|
||
Another Testing Book
|
||
Yue Chen
|
||
test code sort keywords
|
||
ZUCS Print2
|
||
2012
|
||
2222222
|
||
The Testing Book
|
||
CYLL
|
||
keywords debug book
|
||
ZUCS Print2
|
||
2011
|
||
6
|
||
1: The Testing Book
|
||
2: Yue Chen
|
||
3: keywords
|
||
4: ZUCS Print
|
||
5: 2011
|
||
3: blablabla
|
||
</code></pre>
|
||
<h3 id="sample-output-">Sample Output:</h3>
|
||
<pre><code class="lang-out">1: The Testing Book
|
||
1111111
|
||
2222222
|
||
2: Yue Chen
|
||
1111111
|
||
3333333
|
||
3: keywords
|
||
1111111
|
||
2222222
|
||
3333333
|
||
4: ZUCS Print
|
||
1111111
|
||
5: 2011
|
||
1111111
|
||
2222222
|
||
3: blablabla
|
||
Not Found
|
||
</code></pre>
|
||
</div> |