結果

問題 No.1265 Balloon Survival
ユーザー chocono2230chocono2230
提出日時 2020-10-23 22:17:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,426 bytes
コンパイル時間 2,310 ms
コンパイル使用メモリ 213,472 KB
実行使用メモリ 42,612 KB
最終ジャッジ日時 2023-09-28 16:09:02
合計ジャッジ時間 11,644 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 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 1 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 35 ms
8,076 KB
testcase_15 AC 22 ms
6,876 KB
testcase_16 AC 8 ms
4,620 KB
testcase_17 AC 272 ms
23,932 KB
testcase_18 AC 12 ms
5,312 KB
testcase_19 AC 9 ms
4,840 KB
testcase_20 AC 32 ms
8,036 KB
testcase_21 AC 91 ms
13,468 KB
testcase_22 AC 48 ms
9,620 KB
testcase_23 AC 48 ms
10,240 KB
testcase_24 AC 745 ms
42,320 KB
testcase_25 AC 768 ms
42,352 KB
testcase_26 AC 724 ms
42,340 KB
testcase_27 AC 712 ms
42,588 KB
testcase_28 AC 721 ms
42,612 KB
testcase_29 AC 716 ms
42,344 KB
testcase_30 AC 719 ms
42,368 KB
testcase_31 AC 720 ms
42,488 KB
testcase_32 AC 716 ms
42,324 KB
testcase_33 AC 784 ms
42,500 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:37:18: 警告: narrowing conversion of ‘dis’ from ‘double’ to ‘int’ [-Wnarrowing]
   37 |       se.insert({dis, {i, j}});
      |                  ^~~

ソースコード

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<vector<double>> vd(n-1, vector<double>(n-1));
  vector<bool> chk(n-1, false);
  vector<double> dv(n-1);
  set<pair<int, 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