Hack!
시간 제한3초메모리 제한2048 MB
해시 테이블의 버킷 수 n(2 이상 1e9 이하)을 알 수 없을 때, 정수 묶음을 질의해 발생한 충돌 횟수로 n을 알아낸다.
문제
It has been an hour into a Codeforces contest, when you notice that another contestant in your room has solved a problem using an unordered_set. Time to hack!
You know that unordered_set uses a hash table with buckets, which are numbered from to . Unfortunately, you do not know the value of and wish to recover it.
When you insert an integer into the hash table, it is inserted to the ()-th bucket. If there are elements in this bucket prior to the insertion, this will cause hash collisions to occur.
By giving distinct integers to the interactor, you can find out the total number of hash collisions that had occurred while creating an unordered_set containing the numbers. However, feeding this interactor integers in one query will incur a cost of .
For example, if , feeding the interactor with would cause collisions in total:
Note that the interactor creates the hash table by inserting the elements in order into an initially empty unordered_set, and a new empty unordered_set will be created for each query. In other words, all queries are independent.
Your task is to find the number of buckets using total cost of at most .
제한
- , where is the number of multitests.
- for each call to
collisions().
예제
이 문제는 공개된 예제가 없습니다.