• 沒有找到結果。

Mail Data Format

N/A
N/A
Protected

Academic year: 2022

Share "Mail Data Format"

Copied!
3
0
0

加載中.... (立即查看全文)

全文

(1)

Data Structures and Algorithms (NTU, Spring 2011) instructor: Hsuan-Tien Lin

Mail Data Format

Each mail is stored in a file that contains information about sender, date, message-ID, subject, receiver and the content. Note that the Message-ID is an unique positive integer for each mailand the subject may be empty. Also, there is no space in the names of sender and receiver. The file is of the following format:

From: Dora

Date: 13 November 2011 at 13:35 Message-ID: 3

Subject: Bakurans To: Austin

Content:

In Star Wars, the Bakurans were humans inhabiting the planet [Bakura]. Bakurans developed a distinct culture due to their isolated location and their lack of contact with any nonhuman beings besides the Kurtzen natives. The Bakurans descended from the Bakuran Mining Cor- poration colonists who arrived at the planet around 150 BBY. They soon broke away from the corporate control and created their own senate and elected a Prime Minister. The leader of the 150 BBY Bakuran Mining Corporation expedition, Deredith Arden’s descendants were the leaders of the Bakurian government. In 4 ABY the Bakurans joined force with the Alliance to Restore the Republic to ward off the attacking Ssi-Ruuk, a saurian species from the Unknown Regions of the galaxy, who planned to conquer the planet.

Input Format

You program will read a sequence of actions from the standard input one by one. There are three required actions, add, remove and search. Each action is a string in the form of [action name] [argument(s)], action names and arguments are separated by one space.

• add: add file1, where file1 is the path of the file that stores a mail.

• remove: remove id, where id is the unique positive Message-ID of the mail.

• search: search words, where words will in the format of

From [Person1] To [Person2] Before [Date1] After [Date2] [Keywords].

Person1 and Person2 are names in the fields “From” and “To”, respectively. Also, Date1 and Date2 are in the same format as the field “Date” in the mail files. Keywords are words separated by one space. Each keyword is case-sensitive and consists of only alphabets and digits. The words

“From”, “To”, ”Before”, “After” will not appear in Person1, Person2, Date1, Date2 and Keywords

Moreover, Person1,Person2,Date1,Date2 can be the wild-card “-” if there is no restriction. For example, search “From Dora To - Before - After - Bakuran” means getting all the mails from Dora that contains the keyword Bakuran

Output Format

For each action, please output one line to the standard output.

For the search action, you need to output an ordered mail-ID list, with IDs separated by one space.

• add file1: output “Mail ID added, you have N mails”, where ID is the Message-ID of the mail and N is the current number of mails in the pool.

• remove id: output “Mail ID removed, you have N mails”, where ID is the Message-ID to be removed and N is the current number of mails in the pool.

1 of 3

(2)

Data Structures and Algorithms (NTU, Spring 2011) instructor: Hsuan-Tien Lin

• search words: output a mail-ID list, sent from Person1 to Person2 before Date1 and after Data2, as well as containing all the words in Keywords in the field of “Content” or “Subject”.

Note that for the purpose of tokenizing in the field of “Content” or “Subject”, please replace any character other than alphabets and digits to a space. For example, [Bakura] is same as Bakura and NTU-CSIE is same as NTU CSIE.

Error Handling

• remove: If the mail-ID does not exist in the pool, output “Mail does not exist, you have N mails”, where N is the current number of mail in the pool.

• search: If the returned mail-ID list is empty, output “-1”.

Sample Input

add ./mail1

search From - To - Before - After - Muskeg add ./mail2

search From - To - Before - After - Muskeg search From - To - Before - After - is

search From - To - Before 1 May 2011 at 00:00 After - is remove 1

Sample Output

Mail 1 added, you have 1 mails -1

Mail 2 added, you have 2 mails 2

1 2 2 -1

Mail 1 removed, you have 1 mails

Submission Rule

Please upload your program as a single ZIP compressed file our competition website

http://main.learner.csie.ntu.edu.tw/php/dsa12spring/main.php The ZIP file should contain the following items:

• You program , including any package that you use.

• The Makefile.

The website will use the command ”make” and ”make run” to test your program. In order to let the system judge your program correctly, please write your own Makefile that direct the input from a file, namely ”input”, and direct the output to a file, namely ”output.”

Warning : Any kind of cheating and server attack attempting will lead to heavy penalty.

2 of 3

(3)

Data Structures and Algorithms (NTU, Spring 2011) instructor: Hsuan-Tien Lin

Competition Evaluation

We will feed a very long sequence of actions to your program and give you a fixed amount of time. The performance in the competition is measured by how many successive correct answers you can get from the first action in this fixed amount of time.

In order to prevent you from ”querying” or ”overfitting” the order of the action sequence, we’ll secretly run your program by another similar but different sequence of actions. You final score will not only depend on the score board, but also on the hidden performance.

3 of 3

參考文獻

相關文件

Name: Student ID

Calculus II Quiz 2 Apr... Name: Student

Name: Student ID

TA/classroom: Student ID:.

TA/classroom: Student ID:.

Name: Student ID

Để giảm thiểu giấy tờ cần kèm theo khi chủ sử dụng lao động xin tuyển dụng lao động, Bộ lao động sẽ căn cứ vào số chứng minh thư và mối quan hệ trên đơn xin và thông qua

You need to produce an Exam Declaration Form that contains your student ID and the sentence `I will attempt the examination honestly and will report any