#P5266. Student Records Management System
Student Records Management System
Student Records Management System
This problem requires you to design a student records management system. Initially, the records are empty. The system should support at most \(10^5\) operations of the following types:
- Insert/Update (format:
1 NAME SCORE
): Insert a student with name NAME (a string of up to 20 alphanumeric characters; case‐sensitive) and score SCORE (an integer satisfying \(0 < \texttt{SCORE} < 2^{31}\)). If a student with the same name already exists, update the student's score to SCORE. In either case, outputOK
. - Query (format:
2 NAME
): Query the score of the student with name NAME. If the student is not found, outputNot found
; otherwise output the student's score. - Delete (format:
3 NAME
): Delete the record of the student with name NAME. If the student is not found, outputNot found
; otherwise outputDeleted successfully
. - Count (format:
4
): Output the number of students currently in the system.
The input begins with an integer indicating the number of operations, followed by that many operations. Each output should be printed on its own line in the order the operations are processed.
inputFormat
The first line contains an integer \(N\) (\(1 \le N \le 10^5\)), the number of operations. The following \(N\) lines each represent an operation in one of the following formats:
1 NAME SCORE
2 NAME
3 NAME
4
outputFormat
For each operation that requires an output, print the corresponding result on a new line. For an insert/update operation output OK
, for a query output either the student's score or Not found
, for a deletion output either Deleted successfully
or Not found
, and for a count operation output the number of students.
sample
4
1 Alice 90
1 Bob 80
2 Alice
4
OK
OK
90
2
</p>