結果

問題 No.1265 Balloon Survival
ユーザー marroncastlemarroncastle
提出日時 2020-10-23 22:47:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,755 ms / 2,000 ms
コード長 1,293 bytes
コンパイル時間 5,434 ms
コンパイル使用メモリ 276,800 KB
実行使用メモリ 46,800 KB
最終ジャッジ日時 2023-09-28 17:08:21
合計ジャッジ時間 26,099 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 148 ms
8,376 KB
testcase_15 AC 108 ms
8,436 KB
testcase_16 AC 38 ms
5,512 KB
testcase_17 AC 834 ms
40,816 KB
testcase_18 AC 56 ms
5,576 KB
testcase_19 AC 43 ms
5,504 KB
testcase_20 AC 149 ms
8,376 KB
testcase_21 AC 362 ms
14,208 KB
testcase_22 AC 212 ms
14,132 KB
testcase_23 AC 237 ms
13,128 KB
testcase_24 AC 1,742 ms
46,160 KB
testcase_25 AC 1,739 ms
46,680 KB
testcase_26 AC 1,728 ms
46,216 KB
testcase_27 AC 1,711 ms
46,664 KB
testcase_28 AC 1,750 ms
46,044 KB
testcase_29 AC 1,715 ms
46,416 KB
testcase_30 AC 1,705 ms
46,496 KB
testcase_31 AC 1,755 ms
46,548 KB
testcase_32 AC 1,731 ms
46,616 KB
testcase_33 AC 1,733 ms
46,800 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// g++ A.cpp -std=c++14 -I . && ./a.out
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
// using mint = modint1000000007;
// using mint = modint998244353;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll INF = 1e18;
// 変数定義
int N, M, Q, a, b, c, d, e, x, y, T, total, cnt, ans;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N;
  vector<ll> X(N), Y(N);
  rep(i, N)
  {
    cin >> X[i] >> Y[i];
  }
  vector<vector<ll>> dists;
  rep(i, N)
  {
    rep2(j, i + 1, N)
    {
      dists.push_back({(X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j]), i, j});
    }
  }
  sort(all(dists));
  vector<bool> check(N, false);
  for (auto dist : dists)
  {
    // cout << dist[0] << ' ' << dist[1] << ' ' << dist[2] << '\n';
    // cout << ans << '\n';
    if (dist[1] == 0)
    {
      if (check[dist[2]] == false)
      {
        ans++;
        check[dist[2]] = true;
      }
    }
    else if (check[dist[1]] == false && check[dist[2]] == false)
    {
      check[dist[1]] = true;
      check[dist[2]] = true;
    }
  }
  cout << ans << '\n';
  return 0;
}
0