Submission #41943755


Source Code Expand

Copy
#include <bits/stdc++.h>
#define INF (__LONG_LONG_MAX__ / 3)
typedef long long ll;
using namespace std;
ll n, d;
ll a, b, x, y;
vector<pair<ll, ll>> p;
vector<vector<ll>> e;
vector<ll> visited;
void dfs(ll now) {
for(ll next: e[now]) {
if(!visited[next]) {
visited[next] = true;
dfs(next);
}
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
#define INF (__LONG_LONG_MAX__ / 3)
typedef long long ll;
using namespace std;

ll n, d;
ll a, b, x, y;

vector<pair<ll, ll>> p;
vector<vector<ll>> e;
vector<ll> visited;

void dfs(ll now) {
  for(ll next: e[now]) {
    if(!visited[next]) {
      visited[next] = true;
      dfs(next);
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  cin >> n >> d;
  p.resize(n);
  for(ll i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
  }

  e.resize(n + 1);
  for(ll i = 0; i < n; i++) {
    for(ll j = 0; j < n; j++) {
      if(i == j) continue;
      if((p[i].first - p[j].first) * (p[i].first - p[j].first) + (p[i].second - p[j].second) * (p[i].second - p[j].second) <= d * d) {
        e[i].push_back(j);
      }
    }
  }

  visited.assign(n, false);
  visited[0] = true;
  dfs(0);
  for(ll i = 0; i < n; i++) {
    if(visited[i]) {
      cout << "Yes\n";
    } else {
      cout << "No\n";
    }
  }

  
  return 0;
}

Submission Info

Submission Time
Task C - Virus
User jbhus
Language C++ (GCC 9.2.1)
Score 300
Code Size 1033 Byte
Status AC
Exec Time 53 ms
Memory 34212 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 38
Set Name Test Cases
Sample sample00.txt, sample01.txt, sample02.txt
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt, testcase28.txt, testcase29.txt, testcase30.txt, testcase31.txt, testcase32.txt, testcase33.txt, testcase34.txt
Case Name Status Exec Time Memory
sample00.txt AC 6 ms 3532 KB
sample01.txt AC 3 ms 3480 KB
sample02.txt AC 2 ms 3488 KB
testcase00.txt AC 2 ms 3524 KB
testcase01.txt AC 18 ms 3760 KB
testcase02.txt AC 15 ms 3740 KB
testcase03.txt AC 19 ms 3796 KB
testcase04.txt AC 14 ms 3820 KB
testcase05.txt AC 16 ms 4032 KB
testcase06.txt AC 15 ms 4224 KB
testcase07.txt AC 14 ms 4200 KB
testcase08.txt AC 15 ms 4268 KB
testcase09.txt AC 15 ms 4208 KB
testcase10.txt AC 17 ms 4448 KB
testcase11.txt AC 14 ms 4140 KB
testcase12.txt AC 14 ms 4072 KB
testcase13.txt AC 17 ms 4340 KB
testcase14.txt AC 19 ms 4256 KB
testcase15.txt AC 14 ms 4236 KB
testcase16.txt AC 15 ms 4196 KB
testcase17.txt AC 15 ms 4112 KB
testcase18.txt AC 16 ms 4460 KB
testcase19.txt AC 15 ms 4188 KB
testcase20.txt AC 15 ms 4272 KB
testcase21.txt AC 16 ms 4128 KB
testcase22.txt AC 22 ms 4628 KB
testcase23.txt AC 15 ms 4052 KB
testcase24.txt AC 16 ms 4436 KB
testcase25.txt AC 13 ms 3676 KB
testcase26.txt AC 15 ms 3628 KB
testcase27.txt AC 16 ms 3792 KB
testcase28.txt AC 14 ms 3840 KB
testcase29.txt AC 14 ms 3812 KB
testcase30.txt AC 14 ms 3752 KB
testcase31.txt AC 19 ms 4012 KB
testcase32.txt AC 22 ms 4864 KB
testcase33.txt AC 53 ms 23692 KB
testcase34.txt AC 43 ms 34212 KB


2025-03-05 (Wed)
18:12:02 +00:00