結果
| 問題 | No.1265 Balloon Survival |
| コンテスト | |
| ユーザー |
mmn15277198
|
| 提出日時 | 2020-11-17 14:27:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,786 bytes |
| 記録 | |
| コンパイル時間 | 1,039 ms |
| コンパイル使用メモリ | 103,588 KB |
| 実行使用メモリ | 13,432 KB |
| 最終ジャッジ日時 | 2024-07-23 08:16:55 |
| 合計ジャッジ時間 | 3,132 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 WA * 17 |
ソースコード
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>
#include<set>
#define rep(i,n) for(int (i) = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
//const ll mod = 1e9 + 7;
const ll mod = 998244353;
const int inf = 123456;
const int siz = 202020;
ll dist(int a , int b , int c , int d){
return (a - b)*(a - b) + (c - d)*(c - d);
}
int main() {
int n;
cin >> n;
vector<int> x(n) , y(n);
for(int i = 0; i < n; i++){
cin >> x[i] >> y[i];
}
vector<pair<ll , pair<int , int> > > v;
for(int i = 0; i < n - 1; i++){
for(int j = i + 1; j < n; j++){
ll d = dist(x[i] , x[j] , y[i] , y[j]);
v.push_back(make_pair(d , make_pair(i , j)));
}
}
sort(v.begin() , v.end());
vector<int> used(n + 100 , false);
int ans = 0;
for(int i = 0; i < v.size(); i++){
int x = v[i].second.first;
int y = v[i].second.second;
//cout << x << " : " << y << endl;
if(x == 0 && y == 0){
continue;
}
if(used[x] == true || used[y] == true){
continue;
}
if(x == 0 && used[y] == false){
used[y] = true;
ans++;
continue;
}
if(y == 0 && used[x] == false){
used[x] = true;
ans++;
continue;
}
used[x] = true;
used[y] = true;
}
cout << ans << endl;
return 0;
}
mmn15277198