제출 #255403

#제출 시각아이디문제언어결과실행 시간메모리
255403islingrExamination (JOI19_examination)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (auto i = (a); i < (b); ++i) #define sz(x) int((x).size()) #define eb(x...) emplace_back(x) #define lb(x...) lower_bound(x) #define all(x) begin(x), end(x) const int N = 1 << 17; int n, m; int t[4 * N]; int query(int l, int r) { int sum = 0; for (l += m, r += m; l < r; l >>= 1, r >>= 1) { if (l & 1) sum += t[l++]; if (r & 1) sum += t[--r]; } return sum; } void update(int p, int x) { for (t[p += m] += x; p >>= 1; ) t[p] = t[p << 1] + t[p << 1|1]; } struct P { int x, y, z, idx; bool operator<(const P &p) { return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx); } } a[2 * N], tmp[2 * N]; int ans[N]; void cdq(int l, int r) { if (r - l == 1) return; int m = (l + r) / 2; cdq(l, m); cdq(m, r); vector<int> op; int i = l, j = m, k = l, cnt = 0; while (i < m && j < r) if (a[j].y < a[i].y) { if (!a[i].idx) ++cnt, update(a[i].z, 1), op.eb(a[i].z); tmp[k++] = a[i++]; } else { if (a[j].idx) ans[a[j].idx] += cnt - query(0, a[j].z); tmp[k++] = a[j++]; } while (i < m) tmp[k++] = a[i++]; while (j < r) { if (a[j].idx) ans[a[j].idx] += cnt - query(0, a[j].z); tmp[k++] = a[j++]; } rep(i, l, r) a[i] = tmp[i]; for (int p : op) update(p, -1); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); vector<int> cmp; int q; cin >> n >> q; rep(i, 0, n) { int x, y; cin >> x >> y; a[i] = {x, y, x + y, 0}; cmp.eb(x + y); } rep(i, 0, q) { int x, y, z; cin >> x >> y >> z; a[i + n] = {--x, --y, z, i + 1}; cmp.eb(z); } sort(all(cmp)); cmp.resize(m = unique(all(cmp)) - begin(cmp)); rep(i, 0, n + q) a[i].z = lb(all(cmp), a[i].z) - begin(cmp); sort(a, a + n + q); cdq(0, n + q); rep(i, 0, q) cout << ans[i + 1] << '\n'; }

컴파일 시 표준 에러 (stderr) 메시지

examination.cpp: In member function 'bool P::operator<(const P&)':
examination.cpp:29:44: error: no matching function for call to 'std::tuple<int, int, int>::tuple(int, int&, int&, int&)'
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:828:11: note: candidate: template<class _Alloc, class _Dummy, class ... _UElements, typename std::enable_if<((std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tail ...> >::value)), int, int, int>::_MoveConstructibleTuple<_UElements ...>() && (! std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tail ...> >::value)), int, int, int>::_ImplicitlyMoveConvertibleTuple<_UElements ...>())) && std::_TC<(std::is_same<_Dummy, void>::value && (3 == 1)), int, int, int>::_NonNestedTuple<tuple<_Tail ...>&&>()), bool>::type <anonymous> > std::tuple<_Elements>::tuple(std::allocator_arg_t, const _Alloc&, std::tuple<_Args2 ...>&&)
  explicit tuple(allocator_arg_t __tag, const _Alloc& __a,
           ^~~~~
/usr/include/c++/7/tuple:828:11: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   mismatched types 'std::tuple<_Tail ...>' and 'int'
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:813:2: note: candidate: template<class _Alloc, class _Dummy, class ... _UElements, typename std::enable_if<((std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tail ...> >::value)), int, int, int>::_MoveConstructibleTuple<_UElements ...>() && std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tail ...> >::value)), int, int, int>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && std::_TC<(std::is_same<_Dummy, void>::value && (3 == 1)), int, int, int>::_NonNestedTuple<tuple<_Tail ...>&&>()), bool>::type <anonymous> > std::tuple<_Elements>::tuple(std::allocator_arg_t, const _Alloc&, std::tuple<_Args2 ...>&&)
  tuple(allocator_arg_t __tag, const _Alloc& __a,
  ^~~~~
/usr/include/c++/7/tuple:813:2: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   mismatched types 'std::tuple<_Tail ...>' and 'int'
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:798:11: note: candidate: template<class _Alloc, class _Dummy, class ... _UElements, typename std::enable_if<((std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tail ...> >::value)), int, int, int>::_ConstructibleTuple<_UElements ...>() && (! std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tail ...> >::value)), int, int, int>::_ImplicitlyConvertibleTuple<_UElements ...>())) && std::_TC<(std::is_same<_Dummy, void>::value && (3 == 1)), int, int, int>::_NonNestedTuple<tuple<_Tail ...>&&>()), bool>::type <anonymous> > std::tuple<_Elements>::tuple(std::allocator_arg_t, const _Alloc&, const std::tuple<_Args2 ...>&)
  explicit tuple(allocator_arg_t __tag, const _Alloc& __a,
           ^~~~~
/usr/include/c++/7/tuple:798:11: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   mismatched types 'const std::tuple<_Tail ...>' and 'int'
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:783:2: note: candidate: template<class _Alloc, class _Dummy, class ... _UElements, typename std::enable_if<((std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tail ...> >::value)), int, int, int>::_ConstructibleTuple<_UElements ...>() && std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tail ...> >::value)), int, int, int>::_ImplicitlyConvertibleTuple<_UElements ...>()) && std::_TC<(std::is_same<_Dummy, void>::value && (3 == 1)), int, int, int>::_NonNestedTuple<tuple<_Tail ...>&&>()), bool>::type <anonymous> > std::tuple<_Elements>::tuple(std::allocator_arg_t, const _Alloc&, const std::tuple<_Args2 ...>&)
  tuple(allocator_arg_t __tag, const _Alloc& __a,
  ^~~~~
/usr/include/c++/7/tuple:783:2: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   mismatched types 'const std::tuple<_Tail ...>' and 'int'
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:771:2: note: candidate: template<class _Alloc> std::tuple<_Elements>::tuple(std::allocator_arg_t, const _Alloc&, std::tuple<_Elements>&&)
  tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in)
  ^~~~~
/usr/include/c++/7/tuple:771:2: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   candidate expects 3 arguments, 4 provided
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:767:2: note: candidate: template<class _Alloc> std::tuple<_Elements>::tuple(std::allocator_arg_t, const _Alloc&, const std::tuple<_Elements>&)
  tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in)
  ^~~~~
/usr/include/c++/7/tuple:767:2: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   candidate expects 3 arguments, 4 provided
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:761:11: note: candidate: template<class _Alloc, class ... _UElements, typename std::enable_if<(std::_TC<((3 == sizeof... (_UElements)) && std::_TC<(sizeof... (_UElements) == 1), int, int, int>::_NotSameTuple<_UElements ...>()), int, int, int>::_MoveConstructibleTuple<_UElements ...>() && (! std::_TC<((3 == sizeof... (_UElements)) && std::_TC<(sizeof... (_UElements) == 1), int, int, int>::_NotSameTuple<_UElements ...>()), int, int, int>::_ImplicitlyMoveConvertibleTuple<_UElements ...>())), bool>::type <anonymous> > std::tuple<_Elements>::tuple(std::allocator_arg_t, const _Alloc&, _UElements&& ...)
  explicit tuple(allocator_arg_t __tag, const _Alloc& __a,
           ^~~~~
/usr/include/c++/7/tuple:761:11: note:   template argument deduction/substitution failed:
examination.cpp:29:31: note:   cannot convert '-((P*)this)->P::x' (type 'int') to type 'std::allocator_arg_t'
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                               ^~
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:750:2: note: candidate: template<class _Alloc, class ... _UElements, typename std::enable_if<(std::_TC<((3 == sizeof... (_UElements)) && std::_TC<(sizeof... (_UElements) == 1), int, int, int>::_NotSameTuple<_UElements ...>()), int, int, int>::_MoveConstructibleTuple<_UElements ...>() && std::_TC<((3 == sizeof... (_UElements)) && std::_TC<(sizeof... (_UElements) == 1), int, int, int>::_NotSameTuple<_UElements ...>()), int, int, int>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()), bool>::type <anonymous> > std::tuple<_Elements>::tuple(std::allocator_arg_t, const _Alloc&, _UElements&& ...)
  tuple(allocator_arg_t __tag, const _Alloc& __a,
  ^~~~~
/usr/include/c++/7/tuple:750:2: note:   template argument deduction/substitution failed:
examination.cpp:29:31: note:   cannot convert '-((P*)this)->P::x' (type 'int') to type 'std::allocator_arg_t'
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                               ^~
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:740:11: note: candidate: template<class _Alloc, class _Dummy, typename std::enable_if<(std::_TC<std::is_same<_Dummy, void>::value, int, int, int>::_ConstructibleTuple<int, int, int>() && (! std::_TC<std::is_same<_Dummy, void>::value, int, int, int>::_ImplicitlyConvertibleTuple<int, int, int>())), bool>::type <anonymous> > std::tuple<_Elements>::tuple(std::allocator_arg_t, const _Alloc&, const _Elements& ...)
  explicit tuple(allocator_arg_t __tag, const _Alloc& __a,
           ^~~~~
/usr/include/c++/7/tuple:740:11: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   candidate expects 5 arguments, 4 provided
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:729:2: note: candidate: template<class _Alloc, class _Dummy, typename std::enable_if<(std::_TC<std::is_same<_Dummy, void>::value, int, int, int>::_ConstructibleTuple<int, int, int>() && std::_TC<std::is_same<_Dummy, void>::value, int, int, int>::_ImplicitlyConvertibleTuple<int, int, int>()), bool>::type <anonymous> > std::tuple<_Elements>::tuple(std::allocator_arg_t, const _Alloc&, const _Elements& ...)
  tuple(allocator_arg_t __tag, const _Alloc& __a,
  ^~~~~
/usr/include/c++/7/tuple:729:2: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   candidate expects 5 arguments, 4 provided
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:719:2: note: candidate: template<class _Alloc> std::tuple<_Elements>::tuple(std::allocator_arg_t, const _Alloc&)
  tuple(allocator_arg_t __tag, const _Alloc& __a)
  ^~~~~
/usr/include/c++/7/tuple:719:2: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   candidate expects 2 arguments, 4 provided
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:713:28: note: candidate: template<class ... _UElements, class _Dummy, typename std::enable_if<((std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tps ...> >::value)), int, int, int>::_MoveConstructibleTuple<_UElements ...>() && (! std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tps ...> >::value)), int, int, int>::_ImplicitlyMoveConvertibleTuple<_UElements ...>())) && std::_TC<(std::is_same<_Dummy, void>::value && (3 == 1)), int, int, int>::_NonNestedTuple<tuple<_Tps ...>&&>()), bool>::type <anonymous> > constexpr std::tuple<_Elements>::tuple(std::tuple<_Args1 ...>&&)
         explicit constexpr tuple(tuple<_UElements...>&& __in)
                            ^~~~~
/usr/include/c++/7/tuple:713:28: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   mismatched types 'std::tuple<_Tps ...>' and 'int'
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:702:19: note: candidate: template<class ... _UElements, class _Dummy, typename std::enable_if<((std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tps ...> >::value)), int, int, int>::_MoveConstructibleTuple<_UElements ...>() && std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tps ...> >::value)), int, int, int>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && std::_TC<(std::is_same<_Dummy, void>::value && (3 == 1)), int, int, int>::_NonNestedTuple<tuple<_Tps ...>&&>()), bool>::type <anonymous> > constexpr std::tuple<_Elements>::tuple(std::tuple<_Args1 ...>&&)
         constexpr tuple(tuple<_UElements...>&& __in)
                   ^~~~~
/usr/include/c++/7/tuple:702:19: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   mismatched types 'std::tuple<_Tps ...>' and 'int'
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:690:28: note: candidate: template<class ... _UElements, class _Dummy, typename std::enable_if<((std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tps ...> >::value)), int, int, int>::_ConstructibleTuple<_UElements ...>() && (! std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tps ...> >::value)), int, int, int>::_ImplicitlyConvertibleTuple<_UElements ...>())) && std::_TC<(std::is_same<_Dummy, void>::value && (3 == 1)), int, int, int>::_NonNestedTuple<const tuple<_Tps ...>&>()), bool>::type <anonymous> > constexpr std::tuple<_Elements>::tuple(const std::tuple<_Args1 ...>&)
         explicit constexpr tuple(const tuple<_UElements...>& __in)
                            ^~~~~
/usr/include/c++/7/tuple:690:28: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   mismatched types 'const std::tuple<_Tps ...>' and 'int'
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:678:19: note: candidate: template<class ... _UElements, class _Dummy, typename std::enable_if<((std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tps ...> >::value)), int, int, int>::_ConstructibleTuple<_UElements ...>() && std::_TC<((3 == sizeof... (_UElements)) && (! std::is_same<std::tuple<int, int, int>, std::tuple<_Tps ...> >::value)), int, int, int>::_ImplicitlyConvertibleTuple<_UElements ...>()) && std::_TC<(std::is_same<_Dummy, void>::value && (3 == 1)), int, int, int>::_NonNestedTuple<const tuple<_Tps ...>&>()), bool>::type <anonymous> > constexpr std::tuple<_Elements>::tuple(const std::tuple<_Args1 ...>&)
         constexpr tuple(const tuple<_UElements...>& __in)
                   ^~~~~
/usr/include/c++/7/tuple:678:19: note:   template argument deduction/substitution failed:
examination.cpp:29:44: note:   mismatched types 'const std::tuple<_Tps ...>' and 'int'
   return tuple<int, int, int>(-x, y, z, idx) < tuple<int, int, int>(-p.x, p.y, p.z, p.idx);
                                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from examination.cpp:1:
/usr/include/c++/7/tuple:662:17: note: candidate: constexpr std::tuple<_Elements>::tuple(std::tuple<_Elements>&&) [with _Elements = {int, int, int}]
       constexpr tuple(tuple&&) = default;
                 ^~~~~
/usr/include/c++/7/tuple:662:17: note:   candidate expects 1 argument, 4 provided
/usr/include/c++/7/tuple:660:17: note: candidate: constexpr std::tuple<_Elements>::tuple(const std::tuple<_Elements>&) [with _Elements = {int, int, int}]
       constexpr tuple(const tuple&) = default;
                 ^~~~~
/usr/include/c++/7/tuple:660:17: note:   candidate expects 1 argument, 4 provided
/usr/include/c++/7/tuple:657:28: note: candidate: template<class ... _UElements, typename std::enable_if<((std::_TC<((3 == sizeof... (_UElements)) && std::_TC<(sizeof... (_UElements) == 1), int, int, int>::_NotSameTuple<_UElements ...>()), int, int, int>::_MoveConstructibleTuple<_UElements ...>() && (! std::_TC<((3 == sizeof... (_UElements)) && std::_TC<(sizeof... (_UElements) == 1), int, int, int>::_NotSameTuple<_UElements ...>()), int, int, int>::_ImplicitlyMoveConvertibleTuple<_UElements ...>())) && (3 >= 1)), bool>::type <anonymous> > constexpr std::tuple<_Elements>::tuple(_UElements&& ...)
         explicit constexpr tuple(_UElements&&... __elements)
                            ^~~~~
/usr/include/c++/7/tuple:657:28: note:   template argument deduction/substitution failed:
/usr/include/c++/7/tuple:656:21: error: no type named 'type' in 'struct std::enable_if<false, bool>'
         bool>::type=false>
                     ^~~~~
/usr/include/c++/7/tuple:656:21: note: invalid template non-type parameter
/usr/include/c++/7/tuple:646:19: note: candidate: template<class ... _UElements, typename std::enable_if<((std::_TC<((3 == sizeof... (_UElements)) && std::_TC<(sizeof... (_UElements) == 1), int, int, int>::_NotSameTuple<_UElements ...>()), int, int, int>::_MoveConstructibleTuple<_UElements ...>() && std::_TC<((3 == sizeof... (_UElements)) && std::_TC<(sizeof... (_UElement