답안 #803857

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
803857 2023-08-03T06:18:47 Z ono_de206 사탕 분배 (IOI21_candies) C++17
컴파일 오류
0 ms 0 KB
#include "candies.h"
#include<bits/stdc++.h>
using namespace std;

#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// #define int long long
 
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

const int mxn = 2e5 + 10;

struct segTreeBeats {
	const long long inf = 1e18;
	struct node {
		long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
		node(int x) : mx1(x), mx2(-inf), mn1(x), mn2(inf), lz(0), mxc(1), mnc(1), sum(x);
		node() {}
		friend node operator+(const node& a) {
			node ret(0);
			ret.mx1 = max(a.mx1, mx1);
			ret.mn1 = min(a.mn1, mn1);
			ret.sum = a.sum + sum;
			if(mx1 == a.mx1) {
				ret.mxc = a.mxc + mxc;
				ret.mx2 = max(a.mx2, mx2);
			} else {
				if(mx1 > a.mx1) {
					ret.mxc = mxc;
					ret.mx2 = max(a.mx1, mx2);
				} else {
					ret.mxc = a.mxc;
					ret.mx2 = max(a.mx2, mx1);
				}
			}

			if(mn1 == a.mn1) {
				ret.mnc = a.mnc + mnc;
				ret.mn2 = min(a.mn2, mn2);
			} else {
				if(mn1 < a.mn1) {
					ret.mnc = mnc;
					ret.mn2 = min(a.mn1, mn2);
				} else {
					ret.mnc = a.mnc;
					ret.mn2 = min(a.mn2, mn1);
				}
			}
			return ret;
		}
	};
	vector<node> d;
	vector<int> c;
	int n;

	void build(int l, int r, int i) {
		if(l == r) {
			d[i] = c[l];
			return;
		}
		int m = (l + r) / 2;
		build(l, m, i * 2);
		build(m + 1, r, i * 2 + 1);
		d[i] = d[i * 2] + d[i * 2 + 1];
	}

	segTreeBeats(int _n, vector<int> _c) {
		n = _n;
		c = _c;
		d.resize(n * 4);
		build(0, n - 1, 1);
	}

	void add(int i, int l, int r, long long v) {
		d[i].sum += 1LL * v * (r - l + 1);
		d[i].mx1 += v; d[i].mn1 += v; d[i].mx2 += v; d[i].mn2 += v;
		d[i].lz += v;
	}

	void mnn(int i, int l, int r, long long v) {
		d[i].sum -= 1LL * (r - l + 1) * d[i].mx1;
		d[i].mx1 = min(d[i],mx1, v);
		d[i].mx2 = min(d[i].mx2, v);
		d[i].mn1 = min(d[i].mn1, v);
		d[i].mn2 = min(d[i].mn2, v);
		d[i].sum += 1LL * (r - l + 1) * d[i].mx1;
	}

	void mxx(int i, int l, int r, long long v) {
		d[i].sum -= 1LL * (r - l + 1) * d[i].mn1;
		d[i].mx1 = max(d[i],mx1, v);
		d[i].mx2 = max(d[i].mx2, v);
		d[i].mn1 = max(d[i].mn1, v);
		d[i].mn2 = max(d[i].mn2, v);
		d[i].sum += 1LL * (r - l + 1) * d[i].mn1;
	}

	void pro(int i, int l, int r) {
		if(l == r) return;
		int m = (l + r) / 2;
		add(i * 2, l, m, d[i].lz);
		add(i * 2 + 1, m + 1, r, d[i].lz);
		d[i].lz = 0;
		mnn(i * 2, l, m, d[i].mn1);
		mnn(i * 2 + 1, m + 1, r, d[i].mn1);

		mxx(i * 2, l, m, d[i].mx1);
		mxx(i * 2 + 1, m + 1, r, d[i].mx1);
	}

	void add(int l, int r, int i, int x, int y, long long v) {
		if(l >= x && r <= y) {
			add(i, l, r, v);
			return;
		}
		pro(i, l, r);
		int m = (l + r) / 2;
		if(x <= m) add(l, m, i * 2, x, y, v);
		if(y > m) add(m + 1, r, i * 2 + 1, x, y, v);
		d[i] = d[i * 2] + d[i * 2 + 1];
	}

	void mnn(int l, int r, int i, int x, int y, long long v) {
		if(d[i].mx1 <= v) return;
		if(l >= x && r <= y && d[i].mx2 < v) {
			mnn(i, l, r, v);
			return;
		}
		pro(i, l, r);
		int m = (l + r) / 2;
		if(x <= m) mnn(l, m, i * 2, x, y, v);
		if(y > m) mnn(m + 1, r, i * 2 + 1, x, y, v);
		d[i] = d[i * 2] + d[i * 2 + 1];
	}

	void mxx(int l, int r, int i, int x, int y, long long v) {
		if(d[i].mn1 >= v) return;
		if(l >= x && r <= y && d[i].mn2 > v) {
			mxx(i, l, r, v);
			return;
		}
		pro(i, l, r);
		int m = (l + r) / 2;
		if(x <= m) mxx(l, m, i * 2, x, y, v);
		if(y > m) mxx(m + 1, r, i * 2 + 1, x, y, v);
		d[i] = d[i * 2] + d[i * 2 + 1];
	}

	void add(int l, int r, long long v) {
		add(0, n - 1, 1, l, r, v);
	}

	void mnn(int l, int r, long long v) {
		mnn(0, n - 1, 1, l, r, v);
	}

	void mxx(int l, int r, long long v) {
		mxx(0, n - 1, 1, l, r, v);
	}
};

vi distribute_candies(vi c, vi l, vi r, vi v) {
	int n = c.size(), q = l.size();
	vector<long long> ret(n);
	if(n * q <= 2000 * 2000) {
		for(int i = 0; i < q; i++) {
			for(int j = l[i]; j <= r[i]; j++) {
				ret[j] += v[i];
				ret[j] = min(1ll * c[j], max(0ll, ret[j]));
			}
		}
		return vector<int>(all(ret));
	}
	if(*max_element(all(v)) >= 0) {
		for(int i = 0; i < q; i++) {
			ret[l[i]] += v[i];
			if(r[i] + 1 < n) ret[r[i] + 1] -= v[i];
		}
		for(int i = 1; i < n; i++) {
			ret[i] += ret[i - 1];
		}
		for(int i = 0; i < n; i++) {
			ret[i] = min(1ll * c[i], max(0ll, ret[i]));
		}
		return vector<int>(all(ret));
	}
	if(*max_element(all(c)) == *min_element(all(c))) {
		segTreeBeats st(n, c);
		for(int i = 0; i < q; i++) {
			st.add(l[i], r[i], v[i]);
			st.mnn(l[i], r[i], c[0]);
			st.mxx(l[i], r[i], 0);
		}
		for(int i = 0; i < n; i++) {
			ret[i] = st.getSum(0, n - 1, 1, i, i);
		}
		return vector<int>(all(ret));
	}
}

Compilation message

candies.cpp: In constructor 'segTreeBeats::node::node(int)':
candies.cpp:27:30: error: invalid use of non-static data member 'segTreeBeats::inf'
   27 |   node(int x) : mx1(x), mx2(-inf), mn1(x), mn2(inf), lz(0), mxc(1), mnc(1), sum(x);
      |                              ^~~
candies.cpp:24:18: note: declared here
   24 |  const long long inf = 1e18;
      |                  ^~~
candies.cpp:27:48: error: invalid use of non-static data member 'segTreeBeats::inf'
   27 |   node(int x) : mx1(x), mx2(-inf), mn1(x), mn2(inf), lz(0), mxc(1), mnc(1), sum(x);
      |                                                ^~~
candies.cpp:24:18: note: declared here
   24 |  const long long inf = 1e18;
      |                  ^~~
candies.cpp:27:82: error: expected '{' at end of input
   27 |   node(int x) : mx1(x), mx2(-inf), mn1(x), mn2(inf), lz(0), mxc(1), mnc(1), sum(x);
      |                                                                                  ^
candies.cpp: In function 'segTreeBeats::node operator+(const segTreeBeats::node&)':
candies.cpp:31:25: error: invalid use of non-static data member 'segTreeBeats::node::mx1'
   31 |    ret.mx1 = max(a.mx1, mx1);
      |                         ^~~
candies.cpp:26:13: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |             ^~~
candies.cpp:32:25: error: invalid use of non-static data member 'segTreeBeats::node::mn1'
   32 |    ret.mn1 = min(a.mn1, mn1);
      |                         ^~~
candies.cpp:26:23: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                       ^~~
candies.cpp:33:22: error: invalid use of non-static data member 'segTreeBeats::node::sum'
   33 |    ret.sum = a.sum + sum;
      |                      ^~~
candies.cpp:26:47: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                                               ^~~
candies.cpp:34:7: error: invalid use of non-static data member 'segTreeBeats::node::mx1'
   34 |    if(mx1 == a.mx1) {
      |       ^~~
candies.cpp:26:13: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |             ^~~
candies.cpp:35:23: error: invalid use of non-static data member 'segTreeBeats::node::mxc'
   35 |     ret.mxc = a.mxc + mxc;
      |                       ^~~
candies.cpp:26:37: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                                     ^~~
candies.cpp:36:26: error: invalid use of non-static data member 'segTreeBeats::node::mx2'
   36 |     ret.mx2 = max(a.mx2, mx2);
      |                          ^~~
candies.cpp:26:18: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                  ^~~
candies.cpp:38:8: error: invalid use of non-static data member 'segTreeBeats::node::mx1'
   38 |     if(mx1 > a.mx1) {
      |        ^~~
candies.cpp:26:13: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |             ^~~
candies.cpp:39:16: error: invalid use of non-static data member 'segTreeBeats::node::mxc'
   39 |      ret.mxc = mxc;
      |                ^~~
candies.cpp:26:37: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                                     ^~~
candies.cpp:40:27: error: invalid use of non-static data member 'segTreeBeats::node::mx2'
   40 |      ret.mx2 = max(a.mx1, mx2);
      |                           ^~~
candies.cpp:26:18: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                  ^~~
candies.cpp:43:27: error: invalid use of non-static data member 'segTreeBeats::node::mx1'
   43 |      ret.mx2 = max(a.mx2, mx1);
      |                           ^~~
candies.cpp:26:13: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |             ^~~
candies.cpp:47:7: error: invalid use of non-static data member 'segTreeBeats::node::mn1'
   47 |    if(mn1 == a.mn1) {
      |       ^~~
candies.cpp:26:23: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                       ^~~
candies.cpp:48:23: error: invalid use of non-static data member 'segTreeBeats::node::mnc'
   48 |     ret.mnc = a.mnc + mnc;
      |                       ^~~
candies.cpp:26:42: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                                          ^~~
candies.cpp:49:26: error: invalid use of non-static data member 'segTreeBeats::node::mn2'
   49 |     ret.mn2 = min(a.mn2, mn2);
      |                          ^~~
candies.cpp:26:28: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                            ^~~
candies.cpp:51:8: error: invalid use of non-static data member 'segTreeBeats::node::mn1'
   51 |     if(mn1 < a.mn1) {
      |        ^~~
candies.cpp:26:23: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                       ^~~
candies.cpp:52:16: error: invalid use of non-static data member 'segTreeBeats::node::mnc'
   52 |      ret.mnc = mnc;
      |                ^~~
candies.cpp:26:42: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                                          ^~~
candies.cpp:53:27: error: invalid use of non-static data member 'segTreeBeats::node::mn2'
   53 |      ret.mn2 = min(a.mn1, mn2);
      |                           ^~~
candies.cpp:26:28: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                            ^~~
candies.cpp:56:27: error: invalid use of non-static data member 'segTreeBeats::node::mn1'
   56 |      ret.mn2 = min(a.mn2, mn1);
      |                           ^~~
candies.cpp:26:23: note: declared here
   26 |   long long mx1, mx2, mn1, mn2, lz, mxc, mnc, sum;
      |                       ^~~
candies.cpp: In member function 'void segTreeBeats::build(int, int, int)':
candies.cpp:74:19: error: no match for 'operator+' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<segTreeBeats::node>, segTreeBeats::node>::value_type' {aka 'segTreeBeats::node'} and '__gnu_cxx::__alloc_traits<std::allocator<segTreeBeats::node>, segTreeBeats::node>::value_type' {aka 'segTreeBeats::node'})
   74 |   d[i] = d[i * 2] + d[i * 2 + 1];
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from candies.h:1,
                 from candies.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:508:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)'
  508 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:508:5: note:   template argument deduction/substitution failed:
candies.cpp:74:32: note:   '__gnu_cxx::__alloc_traits<std::allocator<segTreeBeats::node>, segTreeBeats::node>::value_type' {aka 'segTreeBeats::node'} is not derived from 'const std::reverse_iterator<_Iterator>'
   74 |   d[i] = d[i * 2] + d[i * 2 + 1];
      |                                ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from candies.h:1,
                 from candies.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1540:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)'
 1540 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1540:5: note:   template argument deduction/substitution failed:
candies.cpp:74:32: note:   '__gnu_cxx::__alloc_traits<std::allocator<segTreeBeats::node>, segTreeBeats::node>::value_type' {aka 'segTreeBeats::node'} is not derived from 'const std::move_iterator<_IteratorL>'
   74 |   d[i] = d[i * 2] + d[i * 2 + 1];
      |                                ^
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 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 candies.cpp:2:
/usr/include/c++/10/bits/basic_string.h:6022:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6022 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6022:5: note:   template argument deduction/substitution failed:
candies.cpp:74:32: note:   '__gnu_cxx::__alloc_traits<std::allocator<segTreeBeats::node>, segTreeBeats::node>::value_type' {aka 'segTreeBeats::node'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   74 |   d[i] = d[i * 2] + d[i * 2 + 1];
      |                                ^
In file included from /usr/include/c++/10/string:56,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 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 candies.cpp:2:
/usr/include/c++/10/bits/basic_string.tcc:1160:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 1160 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.tcc:1160:5: note:   template argument deduction/substitution failed:
candies.cpp:74:32: note:   mismatched types 'const _CharT*' and 'segTreeBeats::node'
   74 |   d[i] = d[i * 2] + d[i * 2 + 1];
      |                                ^
In file included from /usr/include/c++/10/string:56,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 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 candies.cpp:2:
/usr/include/c++/10/bits/basic_string.tcc:1180:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 1180 |     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.tcc:1180:5: note:   template argument deduction/substitution failed:
candies.cpp:74:32: note:   '__gnu_cxx::__alloc_traits<std::allocator<segTreeBeats::node>, segTreeBeats::node>::value_type' {aka 'segTreeBeats::node'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   74 |   d[i] = d[i * 2] + d[i * 2 + 1];
      |                                ^
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 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 candies.cpp:2:
/usr/include/c++/10/bits/basic_string.h:6059:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 6059 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6059:5: note:   template argument deduction/substitution failed:
candies.cpp:74:32: note:   '__gnu_cxx::__alloc_traits<std::allocator<segTreeBeats::node>, segTreeBeats::node>::value_type' {aka 'segTreeBeats::node'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   74 |   d[i] = d[i * 2] + d[i * 2 + 1];
      |                                ^
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 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 candies.cpp:2:
/usr/include/c++/10/bits/basic_string.h:6075:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
 6075 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6075:5: note:   template argument deduction/substitution failed:
candies.cpp:74:32: note:   '__gnu_cxx::__alloc_traits<std::allocator<segTreeBeats::node>, segTreeBeats::node>::value_type' {aka 'segTreeBeats::node'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   74 |   d[i] = d[i * 2] + d[i * 2 + 1];
      |                                ^
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 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 candies.cpp:2:
/usr/include/c++/10/bits/basic_string.h:6087:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6087 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6087:5: note:   template argument deduction/substitution failed:
candies.cpp:74:32: note:   '__gnu_cxx::__alloc_traits<std::allocator<segTreeBeats::node>, segTreeBeats::node>::value_type' {aka 'segTreeBeats::node'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   74 |   d[i] = d[i * 2] + d[i * 2 + 1];
      |                                ^
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 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 candies.cpp:2:
/usr/include/c++/10/bits/basic_string.h:6093:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6093 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6093:5: note:   template argument deduction/substitution failed:
candies.cpp:74:32: note:   '__gnu_cxx::__alloc_traits<std::allocator<segTreeBeats::node>, segTreeBeats::node>::value_type' {aka 'segTreeBeats::node'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   74 |   d[i] = d[i * 2] + d[i * 2 + 1];
      |                                ^
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 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,