結果

問題 No.1265 Balloon Survival
ユーザー chocorusk
提出日時 2020-10-23 23:41:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 1,156 bytes
コンパイル時間 1,450 ms
コンパイル使用メモリ 131,304 KB
最終ジャッジ日時 2025-01-15 14:18:00
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
using ll=long long;
typedef pair<int, int> P;
int main()
{
int n; cin>>n;
ll x[1010], y[1010];
for(int i=0; i<n; i++){
cin>>x[i]>>y[i];
}
vector<pair<ll, P>> v;
for(int i=0; i<n; i++){
for(int j=0; j<i; j++){
v.push_back({(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]), {j, i}});
}
}
sort(v.begin(), v.end());
bool b[2020]={};
int ans=0;
for(auto p:v){
int i=p.second.first, j=p.second.second;
if(b[i] || b[j]) continue;
if(i==0){
ans++;
b[j]=1;
}else{
b[i]=b[j]=1;
}
}
cout<<ans<<endl;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0