Submission #879384

#TimeUsernameProblemLanguageResultExecution timeMemory
879384MilosMilutinovicDragon 2 (JOI17_dragon2)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; struct pt { int x, y; }; bool const operator == (pt a, pt b) { return a.x == b.x && a.y == b.y; } struct angle { pt a, b, c; }; bool const operator < (angle p, angle q) { int ps = orient(p.a, p.b, p.c); int qs = orient(q.a, q.b, q.c); if (ps == qs) { return orient(p.a, q.a, p.b) == ps; } else { } } int orient(pt a, pt b, pt c) { long long val = (b.y - a.y) * 1LL * (c.x - b.x) - (b.x - a.x) * 1LL * (c.y - b.y); return (val == 0 ? 0 : (val > 0 ? 1 : -1)); // 1 clock, -1 counterclock } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<pt> p(n); vector<int> c(n); for (int i = 0; i < n; i++) { cin >> p[i].x >> p[i].y >> c[i]; --c[i]; } pt a, b; cin >> a.x >> a.y >> b.x >> b.y; vector<vector<vector<int>>> ids(m, vector<vector<int>>(2)); vector<int> cnt(m); for (int i = 0; i < n; i++) { int o = orient(a, b, p[i]); assert(o != 0); int sd = (o == 1 ? 0 : 1); ids[c[i]][sd].push_back(i); cnt[c[i]] += 1; } vector<angle> all_a; vector<angle> all_b; for (int i = 0; i < m; i++) { all_a.push_back({p[i], a, b}); all_b.push_back({p[i], b, a}); } sort(all_a.begin(), all_a.end()); sort(all_b.begin(), all_b.end()); reverse(all_b.begin(), all_b.end()); vector<int> ia(n); vector<int> ib(n); for (int i = 0; i < n; i++) { ia[i] = (int) (lower_bound(all_a.begin(), all_a.end(), {p[i], a, b}) - all_a.begin()); ib[i] = (int) (lower_bound(all_b.begin(), all_b.end(), {p[i], b, a}) - all_b.begin()); } int q; cin >> q; vector<int> f(q), g(q); vector<vector<vector<vector<array<int, 3>>>> pref_qs(2, vector<vector<array<int, 3>>>(m)); vector<vector<vector<vector<array<int, 3>>>> suff_qs(2, vector<vector<array<int, 3>>>(m)); for (int i = 0; i < m; i++) { pref_qs[0][i].resize(cnt[i]); pref_qs[1][i].resize(cnt[i]); suff_qs[0][i].resize(cnt[i]); suff_qs[1][i].resize(cnt[i]); } for (int i = 0; i < q; i++) { cin >> f[i] >> g[i]; --f[i]; --g[i]; if (cnt[f[i]] < cnt[g[i]]) { for (int sd = 0; sd < 2; sd++) { } } } return 0; }

Compilation message (stderr)

dragon2.cpp: In function 'const bool operator<(angle, angle)':
dragon2.cpp:18:12: error: 'orient' was not declared in this scope; did you mean 'rint'?
   18 |   int ps = orient(p.a, p.b, p.c);
      |            ^~~~~~
      |            rint
dragon2.cpp: In function 'int main()':
dragon2.cpp:66:72: error: no matching function for call to 'lower_bound(std::vector<angle>::iterator, std::vector<angle>::iterator, <brace-enclosed initializer list>)'
   66 |     ia[i] = (int) (lower_bound(all_a.begin(), all_a.end(), {p[i], a, b}) - all_a.begin());
      |                                                                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from dragon2.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:1350:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1350 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_algobase.h:1350:5: note:   template argument deduction/substitution failed:
dragon2.cpp:66:72: note:   couldn't deduce template parameter '_Tp'
   66 |     ia[i] = (int) (lower_bound(all_a.begin(), all_a.end(), {p[i], a, b}) - all_a.begin());
      |                                                                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dragon2.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:2031:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 2031 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_algo.h:2031:5: note:   template argument deduction/substitution failed:
dragon2.cpp:66:72: note:   candidate expects 4 arguments, 3 provided
   66 |     ia[i] = (int) (lower_bound(all_a.begin(), all_a.end(), {p[i], a, b}) - all_a.begin());
      |                                                                        ^
dragon2.cpp:67:72: error: no matching function for call to 'lower_bound(std::vector<angle>::iterator, std::vector<angle>::iterator, <brace-enclosed initializer list>)'
   67 |     ib[i] = (int) (lower_bound(all_b.begin(), all_b.end(), {p[i], b, a}) - all_b.begin());
      |                                                                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from dragon2.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:1350:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1350 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_algobase.h:1350:5: note:   template argument deduction/substitution failed:
dragon2.cpp:67:72: note:   couldn't deduce template parameter '_Tp'
   67 |     ib[i] = (int) (lower_bound(all_b.begin(), all_b.end(), {p[i], b, a}) - all_b.begin());
      |                                                                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dragon2.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:2031:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 2031 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_algo.h:2031:5: note:   template argument deduction/substitution failed:
dragon2.cpp:67:72: note:   candidate expects 4 arguments, 3 provided
   67 |     ib[i] = (int) (lower_bound(all_b.begin(), all_b.end(), {p[i], b, a}) - all_b.begin());
      |                                                                        ^
dragon2.cpp:72:91: error: template argument 1 is invalid
   72 |   vector<vector<vector<vector<array<int, 3>>>> pref_qs(2, vector<vector<array<int, 3>>>(m));
      |                                                                                           ^
dragon2.cpp:72:91: error: template argument 2 is invalid
dragon2.cpp:73:91: error: template argument 1 is invalid
   73 |   vector<vector<vector<vector<array<int, 3>>>> suff_qs(2, vector<vector<array<int, 3>>>(m));
      |                                                                                           ^
dragon2.cpp:73:91: error: template argument 2 is invalid
dragon2.cpp:75:5: error: 'pref_qs' was not declared in this scope
   75 |     pref_qs[0][i].resize(cnt[i]);
      |     ^~~~~~~
dragon2.cpp:77:5: error: 'suff_qs' was not declared in this scope
   77 |     suff_qs[0][i].resize(cnt[i]);
      |     ^~~~~~~