結果

問題 No.1265 Balloon Survival
ユーザー SSRSSSRS
提出日時 2020-10-23 22:14:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 727 bytes
コンパイル時間 1,782 ms
コンパイル使用メモリ 178,708 KB
実行使用メモリ 13,180 KB
最終ジャッジ日時 2023-09-28 16:02:45
合計ジャッジ時間 4,129 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 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 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 11 ms
4,380 KB
testcase_15 AC 9 ms
4,380 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 43 ms
11,980 KB
testcase_18 AC 5 ms
4,376 KB
testcase_19 AC 4 ms
4,376 KB
testcase_20 AC 10 ms
4,380 KB
testcase_21 AC 21 ms
5,148 KB
testcase_22 AC 14 ms
5,272 KB
testcase_23 AC 15 ms
5,272 KB
testcase_24 AC 79 ms
12,880 KB
testcase_25 AC 79 ms
11,972 KB
testcase_26 AC 79 ms
11,716 KB
testcase_27 AC 80 ms
13,180 KB
testcase_28 AC 79 ms
11,644 KB
testcase_29 AC 79 ms
12,956 KB
testcase_30 AC 80 ms
12,200 KB
testcase_31 AC 79 ms
12,224 KB
testcase_32 AC 79 ms
12,072 KB
testcase_33 AC 79 ms
11,396 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> x(N), y(N);
  for (int i = 0; i < N; i++){
    cin >> x[i] >> y[i];
  }
  vector<tuple<double, int, int>> t;
  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      double d = hypot(x[j] - x[i], y[j] - y[i]);
      t.push_back(make_tuple(d, i, j));
    }
  }
  sort(t.begin(), t.end());
  int cnt = t.size();
  vector<bool> r(N, true);
  int ans = 0;
  for (int i = 0; i < cnt; i++){
    int x = get<1>(t[i]);
    int y = get<2>(t[i]);
    if (r[x] && r[y]){
      if (x == 0){
        ans++;
        r[y] = false;
      } else {
        r[x] = false;
        r[y] = false;
      }
    }
  }
  cout << ans << endl;
}
0