結果

問題 No.1265 Balloon Survival
ユーザー kyo1kyo1
提出日時 2020-11-18 08:26:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 963 bytes
コンパイル時間 3,496 ms
コンパイル使用メモリ 212,052 KB
実行使用メモリ 13,640 KB
最終ジャッジ日時 2023-09-30 14:50:35
合計ジャッジ時間 6,213 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,384 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> X(N), Y(N);
  for (int i = 0; i < N; i++) {
    cin >> X[i] >> Y[i];
  }
  priority_queue<pair<double, pair<int, int>>, vector<pair<double, pair<int, int>>>,
                 greater<pair<double, pair<int, int>>>>
      que;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      que.push(make_pair(sqrt((X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j])),
                         make_pair(i, j)));
    }
  }
  int res = 0;
  set<int> st;
  while (!que.empty()) {
    auto q = que.top();
    que.pop();
    int a = q.second.first, b = q.second.second;
    if (a == 0 && st.find(b) == st.end()) {
      res++;
      st.insert(b);
    }
    if (st.find(a) == st.end() && st.find(b) == st.end()) {
      st.insert(a);
      st.insert(b);
    }
  }
  cout << res << '\n';
  return 0;
}
0