시간 제한 | 메모리 제한 | 제출 | 정답 | 맞은 사람 | 정답 비율 |
---|---|---|---|---|---|

1 초 | 256 MB | 11 | 8 | 8 | 72.727% |

Halvor is in charge of the Single Sign-On (SSO) login system for Identity Directories, Inc. He has been a passionate supporter of their technology for years, telling anyone who will listen how it makes user authentication simpler and more secure with the encrypted login backend provided by Trustworthy Enterprises (TE). Last week Halvor got a newsletter from TE, where they introduced their new and highly innovative Open Trust Protection (OTP) system, which was recently implemented and has been used for new accounts and users that changed their password in the last month.

Previously, a user’s cryptographic key consisted of a permutation of the first letters of the alphabet, repeated many times so it could be used for long messages. In the new improved system the cryptographic key instead consists of random letters generated by a lava lamp-based sub-contractor.

As an example the string `BCAEDBCAEDBCAED`

was a possible key in the old system since this is a repetition of `BCAED`

, which is a permutation of the letters from `A`

to `E`

. The strings `BCDBCD`

and `BABBABBABBAB`

would not be possible, since the letter `A`

is missing from the repeated permutation `BCD`

, and `BAB`

is not a permutation of `AB`

since there are two `B`

’s.

Halvor decides to change the keys for the users that have not already been automatically moved to the new system. Luckily he has read and write access to all the keys for his users, and has contracted you to write a program to determine which users need to be updated. To avoid any privacy concerns, you are only given a list of the user’s names, last login times and up to the first 1000 letters of their key.

Thus for the old system the end of the key substring you receive might be cut off in the middle of a repetition, but the first letter is guaranteed to be the start of a permutation. For the new system the entire string will be random, including the letters you receive.

The first line of input contains a single number T, the number of test cases to follow. Each test case consists of one line containing a string K, which is the first part of a user’s cryptographic key.

- 1 ≤ T ≤ 1000
- 1 ≤ |K| ≤ 1000
- All letters in the input string are uppercase (clarification)
- The entropy can be written as \(H\left(X\right) = - \sum_{i=1}^{n}{p\left(x_i\right)\log_b{\left(x_i\right)}}\), where \(p\) denotes the probability mass function of \(X\).

For each test case, output a line containing the line ”old” if K is definitely from the old system, ”new” if K is definitely from the new system, or ”unknown” if this cannot be determined from the provided key substring.

4 ABCD BB HELP IAMTRAPPEDINACRYPTOGRAPHICKEYFACTORY

unknown new unknown new

Contest > IDI Open Contest > IDI Open 2010 I번