結果

問題 No.1265 Balloon Survival
ユーザー chocono2230chocono2230
提出日時 2020-10-23 22:25:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 612 ms / 2,000 ms
コード長 1,374 bytes
コンパイル時間 4,197 ms
コンパイル使用メモリ 212,608 KB
実行使用メモリ 34,848 KB
最終ジャッジ日時 2023-09-28 16:23:10
合計ジャッジ時間 10,387 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 37 ms
7,312 KB
testcase_15 AC 23 ms
6,188 KB
testcase_16 AC 8 ms
4,412 KB
testcase_17 AC 310 ms
19,796 KB
testcase_18 AC 11 ms
5,016 KB
testcase_19 AC 9 ms
4,596 KB
testcase_20 AC 30 ms
7,352 KB
testcase_21 AC 112 ms
11,548 KB
testcase_22 AC 52 ms
8,360 KB
testcase_23 AC 61 ms
9,004 KB
testcase_24 AC 600 ms
34,792 KB
testcase_25 AC 602 ms
34,548 KB
testcase_26 AC 599 ms
34,664 KB
testcase_27 AC 612 ms
34,592 KB
testcase_28 AC 603 ms
34,720 KB
testcase_29 AC 606 ms
34,504 KB
testcase_30 AC 611 ms
34,508 KB
testcase_31 AC 589 ms
34,504 KB
testcase_32 AC 592 ms
34,520 KB
testcase_33 AC 585 ms
34,848 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  pair<int, int> ms;
  int a, b;
  cin >> a >> b;
  ms = {a, b};
  vector<pair<int, int>> ab(n-1);
  rep(i, n-1){
    int a, b;
    cin >> a >> b;
    ab.at(i) = {a, b};
  }
  int ans = 0;
  vector<bool> chk(n-1, false);
  vector<double> dv(n-1);
  set<pair<double, pair<int, int>>> se;
  rep(i, n-1){
    auto [a, b] = ab.at(i);
    double d = hypot(ms.first - a, ms.second - b);
    dv.at(i) = d;
    rep2(j, i+1, n-1){
      auto [a2, b2] = ab.at(j);
      double dis = hypot(a - a2, b - b2);
      se.insert({dis, {i, j}});
    }
  }
  for(auto pp : se){
    auto [dis, ij] = pp;
    auto [i, j] = ij;
    if(chk.at(i) == true || chk.at(j) == true) continue;
    if(dv.at(i) < dis || dv.at(j) < dis) continue;
    chk.at(i) = true;
    chk.at(j) = true;
  }
  rep(i, n-1){
    if(chk.at(i) == false) ans++;
  }
  cout << ans << endl;
  return 0;
}
0