A8152 | Subsegments
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maximum element of those that occur on the given segment exactly once. Help Sasha solve this problem.
输入格式
The first line contains two positive integers $n$ and $k$ ( $1<=n<=10^{5},1<=k<=n$ ) — the number of array elements and the length of the segment.
Then follow $n$ lines: the $i$ -th one contains a single number $a_{i}$ ( $-10^{9}<=a_{i}<=10^{9}$ ).
Then follow $n$ lines: the $i$ -th one contains a single number $a_{i}$ ( $-10^{9}<=a_{i}<=10^{9}$ ).
输出格式
Print $n–k+1$ numbers, one per line: on the $i$ -th line print of the maximum number of those numbers from the subarray $a_{i}$ $a_{i+1}$ … $a_{i+k-1}$ that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
输入输出样例
输入 #1
5 3 1 2 2 3 3
输出 #1
1 3 2
输入 #2
6 4 3 3 3 4 4 2
输出 #2
4 Nothing 3
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted