题目描述
blablabla
样例
blablabla
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define x first
#define y second
using namespace std;
const int N = 1e5 + 10;
typedef pair<int , int > Pll;
Pll st[N];
int pt[N];
int n,d,k;
int main()
{
scanf("%d%d%d",&n,&d,&k);
for(int i = 0 ; i < n ; i ++ ) scanf("%d%d",&st[i].y,&st[i].x);
sort(st,st+n);
int wi = 0;
for(int i = 0; i < n ; )
{
int j = i;
int times = 0;
int ans = 0;
bool t = false;
while(j<n && st[j].x == st[i].x)
{
ans++;
times=st[j].y-st[i].y;
if(ans>=k&× < d)
{
pt[wi++] = st[j].x;
t = true;
break;
}
j++;
}
if(t)
{
while(j<n && st[j].x == st[i].x)j++;
i = j;
}
else i++;
}
for(int i = 0 ; i < wi; i ++ ) cout << pt[i] << endl;
return 0;
}
blablabla