結果
| 問題 | No.1265 Balloon Survival |
| コンテスト | |
| ユーザー |
milanis48663220
|
| 提出日時 | 2020-10-23 22:12:04 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 1,055 bytes |
| 記録 | |
| コンパイル時間 | 1,021 ms |
| コンパイル使用メモリ | 106,708 KB |
| 実行使用メモリ | 13,352 KB |
| 最終ジャッジ日時 | 2026-04-03 04:28:45 |
| 合計ジャッジ時間 | 7,493 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> P_;
typedef pair<ll, P_> P;
int n;
ll x[1000], y[1000];
bool del[1000];
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout << setprecision(10) << fixed;
cin >> n;
for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
vector<P> v;
for(int i = 0; i < n; i++){
for(int j = i+1; j < n; j++){
ll m = (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]);
v.push_back(P(m, P_(i, j)));
}
}
sort(v.begin(), v.end());
int ans = 0;
for(auto p : v){
int i = p.second.first;
int j = p.second.second;
// cout << i << ' ' << j << endl;
if(i == 0 && !del[j]){
ans++;
del[j] = true;
}else{
if((!del[i]) && (!del[j])){
del[i] = true; del[j] = true;
}
}
}
cout << ans << endl;
}
milanis48663220