Dividing DNA
시간 제한2초메모리 제한1024 MB
고정된 문자열에서 부분 문자열이 숨은 데이터베이스에 있는지 최대 2n번 물어보며, 데이터베이스에 없는 서로 겹치지 않는 부분 문자열의 최대 개수를 구한다.
문제
At the Bacteria And Protein Centre, you own a large collection of DNA. In fact, new strands of DNA come in all the time. To organise the vast amount of data, you identify each piece by its unique substrings: substrings that do not already occur in the database.
Your database can quickly determine whether a given piece of DNA occurs as a substring in the database or not. Naturally, if a certain DNA string is found in the database, it also contains all its substrings.
You now want to determine the uniqueness of a given piece of DNA: the maximal number of disjoint substrings it contains that are absent from the database.
You are given the length of the query string , and you can repeatedly ask the database whether it contains the substring .
As an example, consider the first sample interaction. In this case, the database contains strings "TGC" and "CT", and the query string is "CTGCAA". It has uniqueness , because it can be split into the new substrings "CTGC", "A", and "A". The new substring "CTGC" cannot be split up further: for example, the subdivision "CT" and "GC" is not allowed, because both substrings occur (possibly as substrings) in the database. Note that the actual characters in the string are not used in the interaction.
You may use at most queries to the database.