#include #include #include #define ll long long using namespace std; int n, r, br = 1, pos = 1; vector poz; vector poz2; vector poz3; struct kord{ ll x; ll y; ll i; ll xy; }; ll square(ll x) {return x * x;} bool cmp(kord a, kord b){ if(a.x != b.x) return a.x < b.x; else return a.y < b.y; } bool cmp2(kord a, kord b){ if(a.y != b.y) return a.y < b.y; else return a.x < b.x; } bool cmp3(kord a, kord b){ return a.xy < b.xy; } kord a[1000005]; kord b[1000005]; kord c[1000005]; kord d[1000005]; int main(){ freopen("mars.in","r",stdin); freopen("mars.out","w",stdout); cin >> n >> r; for(int i = 1; i <= n; i++){ cin >> a[i].x >> a[i].y; b[i].x = a[i].x; b[i].y = a[i].y; c[i].x = a[i].x; c[i].y = a[i].y; d[i].x = a[i].x; d[i].y = a[i].y; a[i].i = i; b[i].i = i; c[i].i = i; d[i].i = i; d[i].xy = square(d[i].x) + square(d[i].y); } sort(a + 1, a + n + 1, cmp); sort(c + 1, c + n + 1, cmp2); sort(d + 1, d + n + 1, cmp3); //for(int i = 1; i < n; i++) cout << a[i].i << " "; bool dodaj; for(int i = 1; i <= n; i++){ dodaj = true; for(int j = poz.size() - 1; j >= 0; j--) { if(square(a[i].x - b[b[poz[j]].i].x) + square(a[i].y - b[b[poz[j]].i].y) < 4 * square(r)) { dodaj = false; break; } } if(dodaj) poz.push_back(a[i].i); } for(int i = 1; i <= n; i++){ dodaj = true; for(int j = poz2.size() - 1; j >= 0; j--) { if(square(c[i].x - b[b[poz2[j]].i].x) + square(c[i].y - b[b[poz2[j]].i].y) < 4 * square(r)) { dodaj = false; break; } } if(dodaj) poz2.push_back(c[i].i); } for(int i = 1; i <= n; i++){ dodaj = true; for(int j = poz3.size() - 1; j >= 0; j--) { if(square(d[i].x - b[b[poz2[j]].i].x) + square(d[i].y - b[b[poz2[j]].i].y) < 4 * square(r)) { dodaj = false; break; } } if(dodaj) poz3.push_back(d[i].i); } ll poz1size = poz.size(); ll poz2size = poz2.size(); ll poz3size = poz3.size(); ll maxx = max(poz1size, max(poz2size, poz3size)); if(maxx == poz1size){ cout << poz1size << '\n'; for(int i = 0; i < poz1size; i++) cout << poz[i] << " "; }else if(maxx == poz2size){ cout << poz2size << '\n'; for(int i = 0; i < poz2size; i++) cout << poz2[i] << " "; }else{ cout << poz3size << '\n'; for(int i = 0; i < poz3size; i++) cout << poz3[i] << " "; } return 0; } /// ako je n manje od 100 random shuffle