#include #include using namespace std; const int N = 1e5 + 10; typedef pair PII; #define x first #define y second PII logs[N]; bool st[N]; int cnt[N]; int main() { int n, d, k; cin >> n >> d >> k; for (int i = 0; i < n; i++) cin >> logs[i].x >> logs[i].y; //时间,编号 sort(logs, logs + n); //按照时间先排序 for (int i = 0, j = 0; i < n; i++) { cnt[logs[i].y]++; //目标编号出现次数加1 while (logs[i].x - logs[j].x >= d) cnt[logs[j].y]--, j++; //滑动窗口,保证目标区域合法 if (cnt[logs[i].y] >= k) st[logs[i].y] = true; //如果编号次数超K则输出 } for (int i = 0; i < N; i++) if (st[i]) cout << i << endl; return 0; }