#P5266. 【深基17.例6】学籍管理

【深基17.例6】学籍管理

Problem Description

You need to design a student record management system. At the beginning, the student record data is empty. Then the system must support the following operations (no more than 10510^5 operations in total):

  • Insert and update, format 1 NAME SCORE: Insert a student whose name is NAME\texttt{NAME} (a case-sensitive string consisting of letters and digits, with at most 2020 characters) and whose score is SCORE\texttt{SCORE} (0<SCORE<2310<\texttt{SCORE}<2^{31}). If a student with the same name already exists, update this student's score to SCORE\texttt{SCORE}. If the insertion or update succeeds, output OK.
  • Query, format 2 NAME: Query the score of the student whose name is NAME\texttt{NAME}. If the student cannot be found, output Not found; otherwise, output the student's score.
  • Delete, format 3 NAME: Delete the information of the student whose name is NAME\texttt{NAME}. If the student cannot be found, output Not found; otherwise, output Deleted successfully.
  • Summary, format 4: Output the number of students in the system.

Input Format

The first line contains a positive integer QQ (1Q1051 \le Q \le 10^5), which indicates the number of operations.

In the next QQ lines, each line first contains a positive integer opop (op[1,4]op \in [1,4]), which indicates the type of operation. Then:

  • If op=1op = 1, input an additional string NAME\texttt{NAME} and a positive integer SCORE\texttt{SCORE}, with meanings as described above.
  • If op=2op = 2, input an additional string NAME\texttt{NAME}, with meaning as described above.
  • If op=3op = 3, input an additional string NAME\texttt{NAME}, with meaning as described above.
  • If op=4op = 4, no additional input is needed.

Output Format

Output a total of QQ lines. Each line outputs a string or a positive integer, which is the processing result of the corresponding operation. The exact meaning is as described above.

5
1 lxl 10
2 lxl
3 lxl
2 lxl
4
OK
10
Deleted successfully
Not found
0

Hint

Translated by ChatGPT 5