結果
| 問題 |
No.1265 Balloon Survival
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-02-21 11:35:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 119 ms / 2,000 ms |
| コード長 | 650 bytes |
| コンパイル時間 | 1,790 ms |
| コンパイル使用メモリ | 198,908 KB |
| 最終ジャッジ日時 | 2025-01-19 02:58:05 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
#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;
}
Nachia