結果
| 問題 |
No.1265 Balloon Survival
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2020-10-23 22:18:30 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 890 bytes |
| コンパイル時間 | 2,141 ms |
| コンパイル使用メモリ | 200,928 KB |
| 最終ジャッジ日時 | 2025-01-15 13:17:42 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 4 WA * 28 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
int main()
{
int64_t n;
cin >> n;
vector<int64_t> xs(n), ys(n);
for (int64_t i = 0; i < n; i++)
{
cin >> xs[i] >> ys[i];
}
auto dist = [&](int64_t i, int64_t j) {
return (xs[i] - xs[j]) * (xs[i] - xs[j]) + (ys[i] - ys[j]) * (ys[i] - ys[j]);
};
int64_t inf = (1LL << 60);
priority_queue<pair<int64_t, int64_t>, vector<pair<int64_t, int64_t>>, greater<>> pq;
for (int64_t i = 1; i < n; i++)
{
pq.emplace(dist(0, i), i);
}
vector<bool> rm(n, false);
int64_t ans = 0;
while (!pq.empty())
{
auto [d, i] = pq.top();
pq.pop();
int64_t tmp = inf;
for (int64_t j = 0; j < n; j++)
{
if (i == j)
{
continue;
}
if (rm[j])
{
continue;
}
tmp = min(tmp, dist(i, j));
}
if (tmp == d)
{
ans++;
rm[i] = true;
}
}
cout << ans << endl;
return 0;
}
ldsyb