結果

問題 No.1265 Balloon Survival
ユーザー 👑 NachiaNachia
提出日時 2021-02-21 11:35:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 650 bytes
コンパイル時間 2,266 ms
コンパイル使用メモリ 207,640 KB
実行使用メモリ 16,108 KB
最終ジャッジ日時 2023-10-19 12:56:04
合計ジャッジ時間 5,441 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 14 ms
4,968 KB
testcase_15 AC 11 ms
4,968 KB
testcase_16 AC 5 ms
4,348 KB
testcase_17 AC 65 ms
16,108 KB
testcase_18 AC 7 ms
4,348 KB
testcase_19 AC 6 ms
4,348 KB
testcase_20 AC 14 ms
4,968 KB
testcase_21 AC 29 ms
7,400 KB
testcase_22 AC 19 ms
7,396 KB
testcase_23 AC 20 ms
7,396 KB
testcase_24 AC 132 ms
16,108 KB
testcase_25 AC 139 ms
16,108 KB
testcase_26 AC 134 ms
16,108 KB
testcase_27 AC 133 ms
16,108 KB
testcase_28 AC 131 ms
16,108 KB
testcase_29 AC 132 ms
16,108 KB
testcase_30 AC 132 ms
16,108 KB
testcase_31 AC 131 ms
16,108 KB
testcase_32 AC 138 ms
16,108 KB
testcase_33 AC 132 ms
16,108 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using LL=long long;
#define rep(i,n) for(int i=0; i<(n); i++)

struct Pos{ LL x,y; };
bool operator<(Pos l,Pos r){ return false; }

int N;
Pos P[1000];
int F[1000]={};
priority_queue<pair<LL,Pos>> V;
LL dist(int a,int b){
  LL dx=P[a].x-P[b].x;
  LL dy=P[a].y-P[b].y;
  return -dx*dx-dy*dy;
}

int main(){
  cin>>N;
  rep(i,N) cin>>P[i].x>>P[i].y;
  rep(i,N) rep(j,i) V.push({dist(i,j),{i,j}});
  int ans=0;
  while(V.size()){
    Pos p=V.top().second; V.pop();
    if(F[p.x]+F[p.y]) continue;
    if(p.x*p.y==0){ F[p.x+p.y]=1; ans++; continue; }
    F[p.x]=F[p.y]=1;
  }
  cout<<ans<<endl;
  return 0;
}
0