QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#876571 | #7696. Forest for the Trees | WeaRD276 | Compile Error | / | / | C++20 | 2.5kb | 2025-01-31 00:20:55 | 2025-01-31 00:20:56 |
Judging History
This is the latest submission verdict.
- [2025-01-31 00:20:56]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-01-31 00:20:55]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define x first
#define y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
typedef long long ll;
typedef pair<int, int> pii;
struct pair_hash {
size_t operator()(const pii& p) const {
return hash<int>()(p.first) ^ (hash<int>()(p.second) << 1);
}
};
int solve() {
int n, m, r;
if (!(cin >> n >> m >> r)) return 1;
assert(n >= m);
unordered_map<int, unordered_set<int>> tr; // Use a map to reduce hashing overhead
vector<pii> de(m);
FOR(i, 0, n) {
int x, y;
cin >> x >> y;
tr[x].insert(y);
}
FOR(i, 0, m) {
cin >> de[i].x >> de[i].y;
}
auto check = [&](pii pos, int d) -> bool {
FOR(i, 0, m) {
pii cur;
static const int dx[4] = {1, -1, 0, 0};
static const int dy[4] = {0, 0, 1, -1};
cur.x = pos.x + dx[d] * de[i].x + dy[d] * de[i].y;
cur.y = pos.y + dy[d] * de[i].x - dx[d] * de[i].y;
if (tr[cur.x].find(cur.y) == tr[cur.x].end()) return false;
if (abs(pos.x - cur.x) + abs(pos.y - cur.y) > r) return false;
}
return true;
};
unordered_set<tuple<int, int, int>> poses;
for (auto& [x, row] : tr) {
for (int y : row) {
FOR(d, 0, 4) {
pii cur;
static const int dx[4] = {-1, 1, -1, 1};
static const int dy[4] = {-1, 1, 1, -1};
cur.x = x + dx[d] * de[0].x + dy[d] * de[0].y;
cur.y = y + dy[d] * de[0].x - dx[d] * de[0].y;
if (check(cur, d)) {
poses.insert({cur.x, cur.y, d});
}
}
}
}
if (poses.size() == 1) {
auto [px, py, _] = *poses.begin();
cout << px << ' ' << py << '\n';
} else if (poses.empty()) {
cout << "Impossible\n";
} else {
cout << "Ambiguous\n";
}
return 0;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int TET = 1e9;
for (int i = 1; i <= TET; i++) {
if (solve()) break;
}
return 0;
}
Details
answer.code: In function ‘int solve()’: answer.code:61:41: error: use of deleted function ‘std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::tuple<int, int, int>; _Hash = std::hash<std::tuple<int, int, int> >; _Pred = std::equal_to<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >]’ 61 | unordered_set<tuple<int, int, int>> poses; | ^~~~~ In file included from /usr/include/c++/14/unordered_set:41, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:189, from answer.code:1: /usr/include/c++/14/bits/unordered_set.h:142:7: note: ‘std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::tuple<int, int, int>; _Hash = std::hash<std::tuple<int, int, int> >; _Pred = std::equal_to<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >]’ is implicitly deleted because the default definition would be ill-formed: 142 | unordered_set() = default; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/unordered_set.h: At global scope: /usr/include/c++/14/bits/unordered_set.h:142:7: error: use of deleted function ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::tuple<int, int, int>; _Value = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::tuple<int, int, int> >; _Hash = std::hash<std::tuple<int, int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>]’ In file included from /usr/include/c++/14/bits/unordered_map.h:33, from /usr/include/c++/14/unordered_map:41, from /usr/include/c++/14/functional:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53: /usr/include/c++/14/bits/hashtable.h:539:7: note: ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::tuple<int, int, int>; _Value = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::tuple<int, int, int> >; _Hash = std::hash<std::tuple<int, int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>]’ is implicitly deleted because the default definition would be ill-formed: 539 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function ‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::tuple<int, int, int>; _Value = std::tuple<int, int, int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::tuple<int, int, int> >; _Hash = std::hash<std::tuple<int, int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]’ In file included from /usr/include/c++/14/bits/hashtable.h:35: /usr/include/c++/14/bits/hashtable_policy.h:1726:7: note: ‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::tuple<int, int, int>; _Value = std::tuple<int, int, int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::tuple<int, int, int> >; _Hash = std::hash<std::tuple<int, int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]’ is implicitly deleted because the default definition would be ill-formed: 1726 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1726:7: error: use of deleted function ‘std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::tuple<int, int, int>; _Value = std::tuple<int, int, int>; _ExtractKey = std::__detail::_Identity; _Hash = std::hash<std::tuple<int, int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]’ /usr/include/c++/14/bits/hashtable_policy.h: In instantiation of ‘std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::tuple<int, int, int> >]’: /usr/include/c++/14/bits/hashtable_policy.h:1326:7: required from ...