PivotOJ

Garbage In, Garbage Out

시간 제한: 2000ms메모리 제한: 2048MB출처: BAPC 2025BOJ 35210

문제

It is the 25th of July, 2525. Now that the usage of Large Language Models (LLMs) is so ubiquitous, it has become nearly impossible to find actual human-made articles on the internet and not get lost in all the gibberish produced by LLMs.

(Un)fortunately, LLM technology has regressed significantly. Neural networks have been trained on data that is mostly generated by older LLMs, which in turn were trained on even older recycled data. As a result, the output produced by most LLMs is a long string of lowercase letters, each chosen uniformly at random and independently of the others.

You decided to make a program to scavenge the internet in search of human-made articles. Your program must determine whether a given text is human-made or generated by an LLM.

A given text is guaranteed to be exactly one of the following:

  • Human-made, in which case it is a fixed concatenation (without spaces) of words from a given word list.
  • Not human-made and, therefore, generated by an LLM, in which case each character is chosen independently and uniformly at random.

입력

The input consists of:

  • One line with a string ss, the given text to check.
  • One line with an integer nn, the number of words in the word list.
  • nn lines, each with a string ww (6w106 \leq |w| \leq 10), the words in the word list. The words in the word list are distinct and fixed per test case.

All input strings only consist of English lowercase letters (a-z).

Your submission will be run on exactly 100100 test cases, all of which will have s=3105|s| = 3\cdot10^5 and n=5000n = 5000. The samples are smaller and for illustration only.

For each test case where ss is human-made, ss is fixed and does not change between each of your submissions. For each test case where ss is generated by an LLM, each of your submissions will receive a new string ss, generated from independently and uniformly picking random English lowercase letters (a-z).

출력

If the given string was human-made, output "yes". Otherwise, if it was generated by an LLM, output "no".

예제

예제 1

입력
ballooncodingballoonacceptedchallengechallengecoding
5
accepted
balloon
challenge
coding
algorithms
출력
yes

예제 2

입력
nlaiueakuyclocedxlwvxdbiifqjbinucjabzyaqakhohgympi
5
aaaaaaaaaa
bbbbbbbbbb
aababbb
aaabbbaaa
abaaba
출력
no

예제 3

입력
aaaaaaaaaaabbbbbbbbbbaaaaaaaaaaaaaaabbbbbbbbbbbbbb
5
aaaaaaaaa
bbbbbbbbbb
aabbbbb
aaaaabbbb
bbbbba
출력
yes
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.