ผลต่างระหว่างรุ่นของ "01204212/id request"

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
แถว 17: แถว 17:
  
 
== Code ==
 
== Code ==
 +
 +
== Performance comparison ==

รุ่นแก้ไขเมื่อ 19:50, 21 กันยายน 2559

This is part of 01204212

An API requires every user to have a unique ID. To ensure that it provides an interface to check and allocate IDs. There are N requests; each request specifies an ID x, which is an integer from 0 up to 1,000,000,000. For each request, your program have to answer if x has been used. In the case where x is new, it allocates that integer for the requested user. Initially, no ID has been used.

Input

  • First line: an integer N (1<=N<=100,000)
  • The next N lines: each line contains an integer x

Output

There are N lines of output, each contains either Y (if the requested ID has been used before) or N (if the requested ID is new)

Example

Test data

Code

Performance comparison