A11255 | Tom Riddle's Diary
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Harry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Secrets. Harry wants to know the different people who had ever possessed the diary to make sure they are not under its influence.
He has names of $n$ people who possessed the diary in order. You need to tell, for each person, if he/she possessed the diary at some point before or not.
Formally, for a name $s_{i}$ in the $i$ -th line, output "YES" (without quotes) if there exists an index $j$ such that $s_{i}=s_{j}$ and $j<i$ , otherwise, output "NO" (without quotes).
He has names of $n$ people who possessed the diary in order. You need to tell, for each person, if he/she possessed the diary at some point before or not.
Formally, for a name $s_{i}$ in the $i$ -th line, output "YES" (without quotes) if there exists an index $j$ such that $s_{i}=s_{j}$ and $j<i$ , otherwise, output "NO" (without quotes).
输入格式
First line of input contains an integer $n$ ( $1<=n<=100$ ) — the number of names in the list.
Next $n$ lines each contain a string $s_{i}$ , consisting of lowercase English letters. The length of each string is between $1$ and $100$ .
Next $n$ lines each contain a string $s_{i}$ , consisting of lowercase English letters. The length of each string is between $1$ and $100$ .
输出格式
Output $n$ lines each containing either "YES" or "NO" (without quotes), depending on whether this string was already present in the stream or not.
You can print each letter in any case (upper or lower).
You can print each letter in any case (upper or lower).
输入输出样例
输入 #1
6 tom lucius ginny harry ginny harry
输出 #1
NO NO NO NO YES YES
输入 #2
3 a a a
输出 #2
NO YES YES
In test case $1$ , for $i=5$ there exists $j=3$ such that $s_{i}=s_{j}$ and $j<i$ , which means that answer for $i=5$ is "YES".
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted