跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F0785. Heidi and Library (medium)

    ID: 791 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>待分类整理状态难度待定难度共享题库Codeforces英文题面题目来源题面语言

Heidi and Library (medium)

题目描述

B. Heidi and Library (medium)
time limit per test
10 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Whereas humans nowadays read fewer and fewer books on paper, book readership among marmots has surged. Heidi has expanded the library and is now serving longer request sequences.

Input

Same as the easy version, but the limits have changed: 1≤n,k≤400000.

Output

Same as the easy version.

Examples
Input
4 100
1 2 2 1
Output
2
Input
4 1
1 2 2 1
Output
3
Input
4 2
1 2 3 1
Output
3

题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 212 题。保留原作者与原赛事署名。