Submission #1254545

#TimeUsernameProblemLanguageResultExecution timeMemory
1254545M_SH_OLand of the Rainbow Gold (APIO17_rainbow)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "rainbow.h"

#define ll long long
#define ll1 long long
#define ull unsigned long long
#define dou long double
#define str string
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define vbool vector<bool>
#define vstr vector<str>
#define vvll vector<vll>
#define pb push_back
#define pf push_front
#define endl "\n"
#define fr first
#define se second
// #define sortcmp(a) sort(a.begin(), a.end(), cmp)
#define sort(a) sort(a.begin(), a.end())
#define reverse(a) reverse(a.begin(), a.end())
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;
//using namespace __gnu_pbds;

const ll INF = 1e18;
const int lg = 20;

mt19937 rng(time(0));
ll randll(ll l, ll r){
    return uniform_int_distribution<ll>(l, r)(rng);
}

map<ll, vpll> mp;
ll n, m;
vll p, s;

ll find(ll v){
    if(p[v] == v) return v;
    return p[v] = find(p[v]);
}

void unite(ll a, ll b){
    a = find(a);
    b = find(b);
    
    if(a == b) return;
    if(s[a] < s[b]){
        p[a] = b;
        s[b] += s[a];
    }
    else{
        p[b] = a;
        s[a] += s[b];
    }
}

void init(int N, int M, int x, int y, int k, char *s) {
    map<ll, ll> m1;
    n = N, m = M;
    m1[x].pb(y);
    for(int i = 0; i < k; i ++){
        if(s[i] == 'N') x --;
        else if(s[i] == 'S') x ++;
        else if(s[i] == 'W') y --;
        else y ++;
        m1[x].pb(y);
    }
    for(auto i : m1){
        sort(i.se);
        ll l = i.se[0];
        for(int j = 1; j < i.se.size(); i ++){
            if(i.se[j]-1 <= l) continue;
            mp[i.fr].pb({l, i.se[j-1]});
            l = i.se[j];
        }
        mp[i.fr].pb({l, i.se.back()});
    }
    
    p.resize(k*4+7);
    s.resize(k*4+7, 1);
    for(int i = 0; i <= k*4; i ++){
        p[i] = i;
    }
}

int colour(int x, int y, int xr, int yr) {
    ll res = 0, k = 0;
    vpll v, b1;
    for(int i = x; i <= xr; i ++){
        vpll v1;
        pll x = {-1, -1};
        vpll p = mp[i];
        for(int j = 0; j < p.size(); j ++){
            if(p[j].se < y || p[j].fr > yr) continue;
            if(x.fr == -1){
                if(p[j].fr > y) v1.pb(y, p[j].fr-1);
            }
            else{
                v1.pb({x.se+1, p[j].fr-1});
            }
            
            x = {max(y, p[j].fr), min(yr, p[j].se)};
        }
        
        if(x.fr == -1) v1.pb({y, yr});
        else if(x.se < yr) v1.pb({x.se+1, yr});
        
        vll b(v1.size());
        ll l = 0;
        for(int j = 0; j < v1.size(); j ++){
            b[i] = k ++;
            while(l < v.size()){
                if(v[l].se < v1[j].fr){
                    l ++;
                    continue;
                }
                if(v[l].fr > v1[j].se) break;
                unite(b[j], b1[l]);
                if(v[l].se <= v1[j].se){
                    l ++;
                }
                else break;
            }
        }
        b1 = b;
        v = v1;
        
    }
    
    set<ll> s;
    for(int i = 0; i < k; i ++){
        s.insert(find(i));
    }
    
    return s.size();
}

    















Compilation message (stderr)

rainbow.cpp: In function 'void init(int, int, int, int, int, char*)':
rainbow.cpp:16:12: error: request for member 'push_back' in 'm1.std::map<long long int, long long int>::operator[](((std::map<long long int, long long int>::key_type)x))', which is of non-class type 'std::map<long long int, long long int>::mapped_type' {aka 'long long int'}
   16 | #define pb push_back
      |            ^~~~~~~~~
rainbow.cpp:65:11: note: in expansion of macro 'pb'
   65 |     m1[x].pb(y);
      |           ^~
rainbow.cpp:16:12: error: request for member 'push_back' in 'm1.std::map<long long int, long long int>::operator[](((std::map<long long int, long long int>::key_type)x))', which is of non-class type 'std::map<long long int, long long int>::mapped_type' {aka 'long long int'}
   16 | #define pb push_back
      |            ^~~~~~~~~
rainbow.cpp:71:15: note: in expansion of macro 'pb'
   71 |         m1[x].pb(y);
      |               ^~
rainbow.cpp:22:24: error: request for member 'begin' in 'i.std::pair<const long long int, long long int>::second', which is of non-class type 'long long int'
   22 | #define sort(a) sort(a.begin(), a.end())
      |                        ^~~~~
rainbow.cpp:74:9: note: in expansion of macro 'sort'
   74 |         sort(i.se);
      |         ^~~~
rainbow.cpp:22:35: error: request for member 'end' in 'i.std::pair<const long long int, long long int>::second', which is of non-class type 'long long int'
   22 | #define sort(a) sort(a.begin(), a.end())
      |                                   ^~~
rainbow.cpp:74:9: note: in expansion of macro 'sort'
   74 |         sort(i.se);
      |         ^~~~
rainbow.cpp:75:20: error: invalid types 'long long int[int]' for array subscript
   75 |         ll l = i.se[0];
      |                    ^
rainbow.cpp:76:33: error: request for member 'size' in 'i.std::pair<const long long int, long long int>::second', which is of non-class type 'long long int'
   76 |         for(int j = 1; j < i.se.size(); i ++){
      |                                 ^~~~
rainbow.cpp:76:43: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   76 |         for(int j = 1; j < i.se.size(); i ++){
      |                                         ~~^~
rainbow.cpp:77:20: error: invalid types 'long long int[int]' for array subscript
   77 |             if(i.se[j]-1 <= l) continue;
      |                    ^
rainbow.cpp:78:33: error: invalid types 'long long int[int]' for array subscript
   78 |             mp[i.fr].pb({l, i.se[j-1]});
      |                                 ^
rainbow.cpp:78:24: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   78 |             mp[i.fr].pb({l, i.se[j-1]});
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
rainbow.cpp:79:21: error: invalid types 'long long int[int]' for array subscript
   79 |             l = i.se[j];
      |                     ^
rainbow.cpp:81:30: error: request for member 'back' in 'i.std::pair<const long long int, long long int>::second', which is of non-class type 'long long int'
   81 |         mp[i.fr].pb({l, i.se.back()});
      |                              ^~~~
rainbow.cpp:81:20: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   81 |         mp[i.fr].pb({l, i.se.back()});
      |         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
rainbow.cpp:85:7: error: request for member 'resize' in 's', which is of non-class type 'char*'
   85 |     s.resize(k*4+7, 1);
      |       ^~~~~~
rainbow.cpp: In function 'int colour(int, int, int, int)':
rainbow.cpp:101:38: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(int&, long long int)'
  101 |                 if(p[j].fr > y) v1.pb(y, p[j].fr-1);
      |                                 ~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1187:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1203:7: note:   candidate expects 1 argument, 2 provided
rainbow.cpp:107:21: error: no matching function for call to 'max(int&, long long int&)'
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                  ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
rainbow.cpp:107:21: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                  ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
rainbow.cpp:107:21: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                  ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
rainbow.cpp:107:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                  ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
rainbow.cpp:107:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                  ~~~^~~~~~~~~~~~
rainbow.cpp:107:38: error: no matching function for call to 'min(int&, long long int&)'
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                                   ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
rainbow.cpp:107:38: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                                   ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
rainbow.cpp:107:38: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                                   ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3449:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3449:5: note:   template argument deduction/substitution failed:
rainbow.cpp:107:38: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                                   ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3455:5: note:   template argument deduction/substitution failed:
rainbow.cpp:107:38: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                                   ~~~^~~~~~~~~~~~~
rainbow.cpp:107:51: error: no match for 'operator=' (operand types are 'std::pair<long long int, long long int>' and '<brace-enclosed initializer list>')
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                                                   ^
In file included from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:418:9: note: candidate: 'template<class _U1, class _U2> constexpr typename std::enable_if<std::__and_<std::is_assignable<_T1&, const _U1&>, std::is_assignable<_T2&, const _U2&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; _T1 = long long int; _T2 = long long int]'
  418 |         operator=(const pair<_U1, _U2>& __p)
      |         ^~~~~~~~
/usr/include/c++/11/bits/stl_pair.h:418:9: note:   template argument deduction/substitution failed:
rainbow.cpp:107:51: note:   couldn't deduce template parameter '_U1'
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                                                   ^
In file included from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:430:9: note: candidate: 'template<class _U1, class _U2> constexpr typename std::enable_if<std::__and_<std::is_assignable<_T1&, _U1&&>, std::is_assignable<_T2&, _U2&&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; _T1 = long long int; _T2 = long long int]'
  430 |         operator=(pair<_U1, _U2>&& __p)
      |         ^~~~~~~~
/usr/include/c++/11/bits/stl_pair.h:430:9: note:   template argument deduction/substitution failed:
rainbow.cpp:107:51: note:   couldn't deduce template parameter '_U1'
  107 |             x = {max(y, p[j].fr), min(yr, p[j].se)};
      |                                                   ^
In file included from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:390:7: note: candidate: 'constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(typename std::conditional<std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value, const std::pair<_T1, _T2>&, const std::__nonesuch&>::type) [with _T1 = long long int; _T2 = long long int; typename std::conditional<std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value, const std::pair<_T1, _T2>&, const std::__nonesuch&>::type = const std::pair<long long int, long long int>&]'
  390 |       operator=(typename conditional<
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_pair.h:393:55: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::conditional<true, const std::pair<long long int, long long int>&, const std::__nonesuch&>::type' {aka 'const std::pair<long long int, long long int>&'}
  390 |       operator=(typename conditional<
      |                 ~~~~~~~~~~~~~~~~~~~~~                  
  391 |                 __and_<is_copy_assignable<_T1>,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~        
  392 |                        is_copy_assignable<_T2>>::value,
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  393 |                 const pair&, const __nonesuch&>::type __p)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_pair.h:401:7: note: candidate: 'constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(typename std::conditional<std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value, std::pair<_T1, _T2>&&, std::__nonesuch&&>::type) [with _T1 = long long int; _T2 = long long int; typename std::conditional<std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value, std::pair<_T1, _T2>&&, std::__nonesuch&&>::type = std::pair<long long int, long long int>&&]'
  401 |       operator=(typename conditional<
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_pair.h:404:45: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::conditional<true, std::pair<long long int, long long int>&&, std::__nonesuch&&>::type' {aka 'std::pair<long long int, long long int>&&'}
  401 |       operator=(typename conditional<
      |                 ~~~~~~~~~~~~~~~~~~~~~        
  402 |                 __and_<is_move_assignable<_T1>,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  403 |                        is_move_assignable<_T2>>::value,
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  404 |                 pair&&, __nonesuch&&>::type __p)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
rainbow.cpp:123:22: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'long long int'
  123 |                 unite(b[j], b1[l]);
      |                 ~~~~~^~~~~~~~~~~~~
      |                      |
      |                      __gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type {aka std::pair<long long int, long long int>}
rainbow.cpp:47:21: note:   initializing argument 2 of 'void unite(long long int, long long int)'
   47 | void unite(ll a, ll b){
      |                     ^
rainbow.cpp:130:14: error: no match for 'operator=' (operand types are 'std::vector<std::pair<long long int, long long int> >' and 'std::vector<long long int>')
  130 |         b1 = b;
      |              ^
In file included from /usr/include/c++/11/vector:72,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<std::pair<long long int, long long int> >&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from rainbow.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >]'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:709:26: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<std::pair<long long int, long long int> >&&'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >]'
  730 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:730:46: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'std::initializer_list<std::pair<long long int, long long int> >'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~