結果
| 問題 | No.1265 Balloon Survival |
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2020-10-23 22:13:12 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 292 ms / 2,000 ms |
| コード長 | 929 bytes |
| 記録 | |
| コンパイル時間 | 1,578 ms |
| コンパイル使用メモリ | 221,432 KB |
| 実行使用メモリ | 27,088 KB |
| 最終ジャッジ日時 | 2026-06-14 17:17:46 |
| 合計ジャッジ時間 | 6,256 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000003
int main(){
int N;
cin>>N;
vector<long long> x(N),y(N);
rep(i,N){
cin>>x[i]>>y[i];
}
vector<pair<long long,pair<int,int>>> V;
rep(i,N){
for(int j=i+1;j<N;j++){
V.emplace_back((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]),make_pair(i,j));
}
}
sort(V.begin(),V.end());
int ans = 0;
while(V.size()!=0){
vector<pair<long long,pair<int,int>>> nV;
int a = V[0].second.first,b = V[0].second.second;
if(a==0){
ans ++;
rep(j,V.size()){
if(V[j].second.first==b||V[j].second.second==b)continue;
nV.push_back(V[j]);
}
}
else{
rep(j,V.size()){
if(V[j].second.first==a||V[j].second.first==b||V[j].second.second==a||V[j].second.second==b)continue;
nV.push_back(V[j]);
}
}
swap(V,nV);
}
cout<<ans<<endl;
return 0;
}
沙耶花