結果
問題 | No.1265 Balloon Survival |
ユーザー |
![]() |
提出日時 | 2020-10-23 22:12:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 72 ms / 2,000 ms |
コード長 | 1,055 bytes |
コンパイル時間 | 1,159 ms |
コンパイル使用メモリ | 90,956 KB |
実行使用メモリ | 11,636 KB |
最終ジャッジ日時 | 2024-07-21 10:44:49 |
合計ジャッジ時間 | 2,867 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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;}