結果

問題 No.1265 Balloon Survival
コンテスト
ユーザー ocvret_
提出日時 2020-10-23 22:21:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,017 bytes
コンパイル時間 1,904 ms
コンパイル使用メモリ 181,456 KB
実行使用メモリ 50,560 KB
最終ジャッジ日時 2024-07-21 10:59:36
合計ジャッジ時間 9,834 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 4 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
//#include<atcoder/all>

using namespace std;
//using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007

ll pp(ll k){return k*k;}
ll d2(pair<ll,ll> a,pair<ll,ll> b){
  return pp(a.first-b.first)+pp(a.second-b.second);
}

int main(){
  
  int n;
  cin >> n;
  vector<pair<ll,ll>> v(n);
  rep(i,n)cin >> v[i].first >> v[i].second;
  vector<pair<ll,ll>> jun(n);
  vector<multiset<ll>> d(n);
  rep(i,n)for(int j = i+1;j < n;j++){
    d[i].insert(d2(v[i],v[j]));
    d[j].insert(d2(v[j],v[i]));
  }
  rep(i,n)jun[i] = {d2(v[0],v[i]),i};
  sort(ALL(jun));
  vector<int> era;
  int res = 0;
  for(int i = 1;i < n;i++){
    int pos = jun[i].second;
    for(auto au : era){
      d[pos].erase(d2(v[pos],v[au]));
    }
    if(*d[pos].begin() >= d2(v[0],v[pos])){
      res++;
      era.push_back(pos);
    }
  }
  cout << res << "\n";


  return 0;
}
0