开发建设网站的实施过程是一个,网站建设领域文章,wordpress与phpmyadmin,免费做橙光封面的网站题目描述小明维护着一个程序员论坛。现在他收集了一份“点赞”日志#xff0c;日志共有 N 行。其中每一行的格式是 ts id#xff0c;表示在 ts 时刻编号 id 的帖子收到一个“赞”。现在小明想统计有哪些帖子曾经是“热帖”。如果一个帖子曾在任意一个长度为 DD 的时间段内收到…题目描述小明维护着一个程序员论坛。现在他收集了一份“点赞”日志日志共有 N 行。其中每一行的格式是 ts id表示在 ts 时刻编号 id 的帖子收到一个“赞”。现在小明想统计有哪些帖子曾经是“热帖”。如果一个帖子曾在任意一个长度为 DD 的时间段内收到不少于 K 个赞小明就认为这个帖子曾是“热帖”。具体来说如果存在某个时刻 TT满足该帖在 [T,TD) 这段时间内注意是左闭右开区间收到不少于 K 个赞该帖就曾是“热帖”。给定日志请你帮助小明统计出所有曾是“热帖”的帖子编号。输入格式第一行包含三个整数 N、DD和 K。以下 N 行每行一条日志包含两个整数 ts 和 id。输出格式按从小到大的顺序输出热帖 id。每个 id一行。输入输出样例输入7 10 2 0 1 0 10 10 10 10 1 9 1100 3 100 3 输出 1 3 说明/提示对于 50% 的数据1≤K≤N≤1000。对于 100% 的数据 10^51≤K≤N≤10^5 0≤id,ts≤10^5。时限 1 秒, 256M。蓝桥杯 2018 年第九届省赛#includeiostream
#includealgorithm
#includecstring
#includecstdio
#define x first
#define y second
using namespace std;
typedef pairint, int PII;
const int N 100010;
int n, d, k;
PII logs[N];
int cnt[N];
bool st[N]; //记录每个帖子是否是热贴
int main()
{scanf(%d %d %d, n, d, k);for (int i 0; i n; i){scanf(%d %d, logs[i].x, logs[i].y);}sort(logs, logs n);for (int i 0, j 0; i n; i){int id logs[i].y;cnt[id];while (logs[i].x - logs[j].x d){cnt[logs[j].y]--;j;}if (cnt[id] k) st[id] true;}for (int i 0; i 100000; i){if (st[i]){cout i endl;}}return 0;
}