結果
| 問題 |
No.1265 Balloon Survival
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-23 22:31:52 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,030 bytes |
| コンパイル時間 | 2,247 ms |
| コンパイル使用メモリ | 95,244 KB |
| 最終ジャッジ日時 | 2025-01-15 13:29:43 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'void solve()':
main.cpp:31:15: error: 'std::tuple<long long int, int, int> <structured bindings>' has incomplete type
31 | for (auto [t, i, j] : events) {
| ^~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/string:47,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/bits/locale_classes.h:40,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/bits/ios_base.h:41,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/ios:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/ostream:38,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/iostream:39,
from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/bits/stl_iterator.h: In instantiation of 'constexpr __gnu_cxx::__normal_iterator<_Iterator, _Container>& __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator++() [with _Iterator = std::tuple<long long int, int, int>*; _Container = std::vector<std::tuple<long long int, int, int> >]':
main.cpp:31:27: required from here
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/bits/stl_iterator.h:1107:11: error: cannot increment a pointer to incomplete type 'std::tuple<long long int, int, int>'
1107 | ++_M_current;
| ^~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/vector:64,
from main.cpp:3:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/bits/stl_vector.h: In instantiation of 'constexpr std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::tuple<long long int, int, int>; _Alloc = std::allocator<std::tuple<long long int, int, int> >]':
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/bits/stl_vector.h:528:7: required from here
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using lint = long long;
void solve() {
int n;
std::cin >> n;
std::vector<std::pair<lint, lint>> ps(n);
for (auto& [x, y] : ps) std::cin >> x >> y;
std::vector<std::tuple<lint, int, int>> events;
for (int i = 0; i < n; ++i) {
auto [xi, yi] = ps[i];
for (int j = 0; j < i; ++j) {
auto [xj, yj] = ps[j];
auto dx = xi - xj,
dy = yi - yj;
events.emplace_back(dx * dx + dy * dy, j, i);
}
}
std::sort(events.begin(), events.end());
std::vector<bool> erased(n, false);
int ans = 0;
for (auto [t, i, j] : events) {
if (erased[i] || erased[j]) continue;
if (i == 0) {
++ans;
erased[j] = true;
} else {
erased[i] = erased[j] = true;
}
}
std::cout << ans << "\n";
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}