Submission #1036633

#TimeUsernameProblemLanguageResultExecution timeMemory
1036633LudisseyHacker (BOI15_hac)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

namespace std {

// https://judge.yosupo.jp/submission/193613
struct IOPre {
    static constexpr int TEN = 10, SZ = TEN * TEN * TEN * TEN;
    std::array<char, 4 * SZ> num;
    constexpr IOPre() : num{} {
        for (int i = 0; i < SZ; i++) for (int n = i, j = 3; j >= 0; j--) num[i * 4 + j] = n % TEN + '0', n /= TEN;
    }
};

struct IO {
#if !HAVE_DECL_FREAD_UNLOCKED
    #define fread_unlocked fread
#endif
#if !HAVE_DECL_FWRITE_UNLOCKED
    #define fwrite_unlocked fwrite
#endif
    static constexpr int SZ = 1 << 17, LEN = 32, TEN = 10, HUNDRED = TEN * TEN,
                         THOUSAND = HUNDRED * TEN, TENTHOUSAND = THOUSAND * TEN,
                         MAGIC_MULTIPLY = 205, MAGIC_SHIFT = 11, MASK = 15,
                         TWELVE = 12, SIXTEEN = 16;
    static constexpr IOPre io_pre = {};
    std::array<char, SZ> input_buffer, output_buffer;
    int input_ptr_left, input_ptr_right, output_ptr_right;

    IO() : input_buffer{}, output_buffer{}, input_ptr_left{}, input_ptr_right{}, output_ptr_right{} {}
    IO(const IO&) = delete;
    IO(IO&&) = delete;
    IO& operator=(const IO&) = delete;
    IO& operator=(IO&&) = delete;
    ~IO() { flush(); }

    template<typename T> static constexpr bool is_char_v    = std::is_same_v<T, char>;
    template<typename T> static constexpr bool is_bool_v    = std::is_same_v<T, bool>;
    template<typename T> static constexpr bool is_string_v  =
            std::is_same_v<T, std::string> || std::is_same_v<T, const char*> ||
            std::is_same_v<T, char*> || std::is_same_v< std::decay_t<T>, char*>;
    template<typename T> static constexpr bool is_default_v =
            is_char_v<T> || is_bool_v<T> || is_string_v<T> || std::is_integral_v<T>;

    inline void load() {
        memmove(std::begin(input_buffer),
                std::begin(input_buffer) + input_ptr_left,
                input_ptr_right - input_ptr_left);
        input_ptr_right =
            input_ptr_right - input_ptr_left +
            fread_unlocked(
                std::begin(input_buffer) + input_ptr_right - input_ptr_left, 1,
                SZ - input_ptr_right + input_ptr_left, stdin);
        input_ptr_left = 0;
    }

    inline void read_char(char& c) {
        if (input_ptr_left + LEN > input_ptr_right) load();
        c = input_buffer[input_ptr_left++];
    }
    inline void read_string(std::string& x) {
        char c;
        while (read_char(c), c < '!') continue;
        x = c;
        while (read_char(c), c >= '!') x += c;
    }
    template<typename T>
    inline std::enable_if_t<std::is_integral_v<T>, void> read_int(T& x) {
        if (input_ptr_left + LEN > input_ptr_right) load();
        char c = 0;
        do c = input_buffer[input_ptr_left++];
        while (c < '-');
        [[maybe_unused]] bool minus = false;
        if constexpr (std::is_signed<T>::value == true)
            if (c == '-') minus = true, c = input_buffer[input_ptr_left++];
        x = 0;
        while (c >= '0')
            x = x * TEN + (c & MASK), c = input_buffer[input_ptr_left++];
        if constexpr (std::is_signed<T>::value == true)
            if (minus) x = -x;
    }

    inline void skip_space() {
        if (input_ptr_left + LEN > input_ptr_right) load();
        while (input_buffer[input_ptr_left] <= ' ') input_ptr_left++;
    }

    inline void flush() {
        fwrite_unlocked(std::begin(output_buffer), 1, output_ptr_right, stdout);
        output_ptr_right = 0;
    }

    inline void write_char(char c) {
        if (output_ptr_right > SZ - LEN) flush();
        output_buffer[output_ptr_right++] = c;
    }

    inline void write_bool(bool b) {
        if (output_ptr_right > SZ - LEN) flush();
        output_buffer[output_ptr_right++] = b ? '1' : '0';
    }

    inline void write_string(const std::string& s) {
        for (auto x : s) write_char(x);
    }

    inline void write_string(const char* s) {
        while (*s) write_char(*s++);
    }

    inline void write_string(char* s) {
        while (*s) write_char(*s++);
    }

    template <typename T>
    inline std::enable_if_t< std::is_integral_v<T>, void> write_int(T x) {
        if (output_ptr_right > SZ - LEN) flush();
        if (!x) {
            output_buffer[output_ptr_right++] = '0';
            return;
        }
        if constexpr (std::is_signed_v<T>) if (x < 0) output_buffer[output_ptr_right++] = '-', x = -x;
        int i = TWELVE;
        std::array<char, SIXTEEN> buf{};
        for (; x >= TENTHOUSAND; x /= TENTHOUSAND, i -= 4)
            memcpy(std::begin(buf) + i, std::begin(io_pre.num) + (x % TENTHOUSAND) * 4, 4);
        if (x < HUNDRED) {
            if (x < TEN) output_buffer[output_ptr_right++] = '0' + x;
            else {
                uint32_t q = (uint32_t(x) * MAGIC_MULTIPLY) >> MAGIC_SHIFT;
                uint32_t r = uint32_t(x) - q * TEN;
                output_buffer[output_ptr_right++] = '0' + q;
                output_buffer[output_ptr_right++] = '0' + r;
            }
        } else {
            if (x < THOUSAND) 
                memcpy(std::begin(output_buffer) + output_ptr_right, std::begin(io_pre.num) + (x << 2) + 1, 3),
                output_ptr_right += 3;
            else
                memcpy(std::begin(output_buffer) + output_ptr_right, std::begin(io_pre.num) + (x << 2), 4),
                output_ptr_right += 4;
        }
        memcpy(std::begin(output_buffer) + output_ptr_right, std::begin(buf) + i + 4, TWELVE - i);
        output_ptr_right += TWELVE - i;
    }

    template <typename T_>
    std::enable_if_t<(is_default_v< std::remove_cv_t< std::remove_reference_t<T_> > >), IO&> operator<<(T_&& x) {
        using T = std::remove_cv_t< std::remove_reference_t<T_> >;
        if constexpr (is_bool_v<T>) write_bool(x);
        else if constexpr (is_string_v<T>) write_string(x);
        else if constexpr (is_char_v<T>) write_char(x);
        else if constexpr (std::is_integral_v<T>) write_int(x);
        return *this;
    }

    template<typename T>
    std::enable_if_t<(is_default_v<T> && !is_bool_v<T>), IO&> operator>>(T& x) {
        if constexpr (is_string_v<T>) read_string(x);
        else if constexpr (is_char_v<T>) read_char(x);
        else if constexpr (std::is_integral_v<T>) read_int(x);
        return *this;
    }

    IO* tie(std::nullptr_t) { return this; }
    void sync_with_stdio(bool) {}
} io;

} // namespace std

using std::io;

#define cin io
#define cout io

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int n; cin >> n;
    int half=((n+1)/2);
    vector<int> v(n*2,0);
    for (int i = 0; i < v.size(); i++) {
        if(i<n) {
            cin >> v[i];
            v[i+n]=v[i];
        }
        v[i]+=v[i-1];
    }
    deque<int> queue;
    for (int i = 0; i < half; i++)
    {
        while(!queue.empty()&&v[queue.back()+half-1]-v[queue.back()-1]>(v[i+half-1]-v[i-1])) queue.pop_back();
        queue.push_back(i);
    }
    int outp=v[queue.front()+half-1]-v[queue.front()-1];
    for (int i = half; i < (n*2)-half; i++)
    {
        if(!queue.empty()&&queue.front()==i-half) queue.pop_front();
        while(!queue.empty()&&v[queue.back()+half-1]-v[queue.back()-1]>(v[i+half-1]-v[i-1])) queue.pop_back();
        queue.push_back(i);
        outp=max(v[queue.front()+half-1]-v[queue.front()-1], outp);
    }
    cout << outp << "\n";
    return 0;
}

Compilation message (stderr)

hac.cpp:26:38:   in 'constexpr' expansion of 'std::IOPre()'
hac.cpp:11:87: error: call to non-'constexpr' function 'std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](std::array<_Tp, _Nm>::size_type) [with _Tp = char; long unsigned int _Nm = 40000; std::array<_Tp, _Nm>::reference = char&; std::array<_Tp, _Nm>::value_type = char; std::array<_Tp, _Nm>::size_type = long unsigned int]'
   11 |         for (int i = 0; i < SZ; i++) for (int n = i, j = 3; j >= 0; j--) num[i * 4 + j] = n % TEN + '0', n /= TEN;
      |                                                                                       ^
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from hac.cpp:1:
/usr/include/c++/10/array:185:7: note: 'std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](std::array<_Tp, _Nm>::size_type) [with _Tp = char; long unsigned int _Nm = 40000; std::array<_Tp, _Nm>::reference = char&; std::array<_Tp, _Nm>::value_type = char; std::array<_Tp, _Nm>::size_type = long unsigned int]' declared here
  185 |       operator[](size_type __n) noexcept
      |       ^~~~~~~~
hac.cpp:37:68: error: 'is_same_v' is not a member of 'std'; did you mean 'is_same'?
   37 |     template<typename T> static constexpr bool is_char_v    = std::is_same_v<T, char>;
      |                                                                    ^~~~~~~~~
      |                                                                    is_same
hac.cpp:37:79: error: expected primary-expression before ',' token
   37 |     template<typename T> static constexpr bool is_char_v    = std::is_same_v<T, char>;
      |                                                                               ^
hac.cpp:38:68: error: 'is_same_v' is not a member of 'std'; did you mean 'is_same'?
   38 |     template<typename T> static constexpr bool is_bool_v    = std::is_same_v<T, bool>;
      |                                                                    ^~~~~~~~~
      |                                                                    is_same
hac.cpp:38:79: error: expected primary-expression before ',' token
   38 |     template<typename T> static constexpr bool is_bool_v    = std::is_same_v<T, bool>;
      |                                                                               ^
hac.cpp:40:18: error: 'is_same_v' is not a member of 'std'; did you mean 'is_same'?
   40 |             std::is_same_v<T, std::string> || std::is_same_v<T, const char*> ||
      |                  ^~~~~~~~~
      |                  is_same
hac.cpp:40:29: error: expected primary-expression before ',' token
   40 |             std::is_same_v<T, std::string> || std::is_same_v<T, const char*> ||
      |                             ^
hac.cpp:43:68: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
   43 |             is_char_v<T> || is_bool_v<T> || is_string_v<T> || std::is_integral_v<T>;
      |                                                                    ^~~~~~~~~~~~~
      |                                                                    is_integral
hac.cpp:43:83: error: expected primary-expression before '>' token
   43 |             is_char_v<T> || is_bool_v<T> || is_string_v<T> || std::is_integral_v<T>;
      |                                                                                   ^
hac.cpp:43:84: error: expected primary-expression before ';' token
   43 |             is_char_v<T> || is_bool_v<T> || is_string_v<T> || std::is_integral_v<T>;
      |                                                                                    ^
hac.cpp:68:34: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
   68 |     inline std::enable_if_t<std::is_integral_v<T>, void> read_int(T& x) {
      |                                  ^~~~~~~~~~~~~
      |                                  is_integral
hac.cpp:68:34: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
   68 |     inline std::enable_if_t<std::is_integral_v<T>, void> read_int(T& x) {
      |                                  ^~~~~~~~~~~~~
      |                                  is_integral
hac.cpp:68:49: error: template argument 1 is invalid
   68 |     inline std::enable_if_t<std::is_integral_v<T>, void> read_int(T& x) {
      |                                                 ^
hac.cpp:68:50: error: expected unqualified-id before ',' token
   68 |     inline std::enable_if_t<std::is_integral_v<T>, void> read_int(T& x) {
      |                                                  ^
hac.cpp:116:35: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  116 |     inline std::enable_if_t< std::is_integral_v<T>, void> write_int(T x) {
      |                                   ^~~~~~~~~~~~~
      |                                   is_integral
hac.cpp:116:35: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  116 |     inline std::enable_if_t< std::is_integral_v<T>, void> write_int(T x) {
      |                                   ^~~~~~~~~~~~~
      |                                   is_integral
hac.cpp:116:50: error: template argument 1 is invalid
  116 |     inline std::enable_if_t< std::is_integral_v<T>, void> write_int(T x) {
      |                                                  ^
hac.cpp:116:51: error: expected unqualified-id before ',' token
  116 |     inline std::enable_if_t< std::is_integral_v<T>, void> write_int(T x) {
      |                                                   ^
hac.cpp: In member function 'std::enable_if_t<is_default_v<typename std::remove_cv<typename std::remove_reference<_Tp>::type>::type>, std::IO&> std::IO::operator<<(T_&&)':
hac.cpp:150:12: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  150 |         if constexpr (is_bool_v<T>) write_bool(x);
      |            ^~~~~~~~~
hac.cpp:151:17: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  151 |         else if constexpr (is_string_v<T>) write_string(x);
      |                 ^~~~~~~~~
hac.cpp:152:17: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  152 |         else if constexpr (is_char_v<T>) write_char(x);
      |                 ^~~~~~~~~
hac.cpp:153:17: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  153 |         else if constexpr (std::is_integral_v<T>) write_int(x);
      |                 ^~~~~~~~~
hac.cpp:153:33: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  153 |         else if constexpr (std::is_integral_v<T>) write_int(x);
      |                                 ^~~~~~~~~~~~~
      |                                 is_integral
hac.cpp:153:48: error: expected primary-expression before '>' token
  153 |         else if constexpr (std::is_integral_v<T>) write_int(x);
      |                                                ^
hac.cpp:153:49: error: expected primary-expression before ')' token
  153 |         else if constexpr (std::is_integral_v<T>) write_int(x);
      |                                                 ^
hac.cpp: In member function 'std::enable_if_t<(is_default_v<T> && (! is_bool_v<T>)), std::IO&> std::IO::operator>>(T&)':
hac.cpp:159:12: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  159 |         if constexpr (is_string_v<T>) read_string(x);
      |            ^~~~~~~~~
hac.cpp:160:17: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  160 |         else if constexpr (is_char_v<T>) read_char(x);
      |                 ^~~~~~~~~
hac.cpp:161:17: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  161 |         else if constexpr (std::is_integral_v<T>) read_int(x);
      |                 ^~~~~~~~~
hac.cpp:161:33: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  161 |         else if constexpr (std::is_integral_v<T>) read_int(x);
      |                                 ^~~~~~~~~~~~~
      |                                 is_integral
hac.cpp:161:48: error: expected primary-expression before '>' token
  161 |         else if constexpr (std::is_integral_v<T>) read_int(x);
      |                                                ^
hac.cpp:161:49: error: expected primary-expression before ')' token
  161 |         else if constexpr (std::is_integral_v<T>) read_int(x);
      |                                                 ^
hac.cpp: In function 'int main()':
hac.cpp:178:13: error: no match for 'operator>>' (operand types are 'std::IO' and 'int')
  178 |  int n; cin >> n;
      |             ^~ ~
      |                |
      |                int
hac.cpp:158:63: note: candidate: 'template<class T> std::enable_if_t<(is_default_v<T> && (! is_bool_v<T>)), std::IO&> std::IO::operator>>(T&)'
  158 |     std::enable_if_t<(is_default_v<T> && !is_bool_v<T>), IO&> operator>>(T& x) {
      |                                                               ^~~~~~~~
hac.cpp:158:63: note:   template argument deduction/substitution failed:
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 hac.cpp:1:
/usr/include/c++/10/bits/basic_string.tcc:1476:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 1476 |     operator>>(basic_istream<_CharT, _Traits>& __in,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.tcc:1476:5: note:   template argument deduction/substitution failed:
hac.cpp:178:16: note:   'std::IO' is not derived from 'std::basic_istream<_CharT, _Traits>'
  178 |  int n; cin >> n;
      |                ^
In file included from /usr/include/c++/10/istream:991,
                 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 hac.cpp:1:
/usr/include/c++/10/bits/istream.tcc:931:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)'
  931 |     operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
      |     ^~~~~~~~
/usr/include/c++/10/bits/istream.tcc:931:5: note:   template argument deduction/substitution failed:
hac.cpp:178:16: note:   'std::IO' is not derived from 'std::basic_istream<_CharT, _Traits>'
  178 |  int n; cin >> n;
      |                ^
In file included 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 hac.cpp:1:
/usr/include/c++/10/istream:756:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)'
  756 |     operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
      |     ^~~~~~~~
/usr/include/c++/10/istream:756:5: note:   template argument deduction/substitution failed:
hac.cpp:178:16: note:   'std::IO' is not derived from 'std::basic_istream<char, _Traits>'
  178 |  int n; cin >> n;
      |                ^
In file included 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 hac.cpp:1:
/usr/include/c++/10/istream:761:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)'
  761 |     operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
      |     ^~~~~~~~
/usr/include/c++/10/istream:761:5: note:   template argument deduction/substitution failed:
hac.cpp:178:16: note:   'std::IO' is not derived from 'std::basic_istream<char, _Traits>'
  178 |  int n; cin >> n;
      |                ^
In file included from /usr/include/c++/10/istream:991,
                 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 hac.cpp:1:
/usr/include/c++/10/bits/istream.tcc:963:5: note: candidate: 'template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)'
  963 |     operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
      |     ^~~~~~~~
/usr/include/c++/10/bits/istream.tcc:963:5: note:   template argument deduction/substitution failed:
hac.cpp:178:16: note:   'std::IO' is not derived from 'std::basic_istream<_CharT, _Traits>'
  178 |  int n; cin >> n;
      |                ^
In file included 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 hac.cpp:1:
/usr/include/c++/10/istream:803:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)'
  803 |     operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
      |     ^~~~~~~~
/usr/include/c++/10/istream:803:5: note:   template argument deduction/substitution failed:
hac.cpp:178:16: note:   'std::IO' is not derived from 'std::basic_istream<char, _Traits>'
  178 |  int n; cin >> n;
      |                ^
In file included 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 hac.cpp:1:
/usr/include/c++/10/istream:808:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)'
  808 |     operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
      |     ^~~~~~~~
/usr/include/c++/10/istream:808:5: note:   template argument deduction/substitution failed:
hac.cpp:178:16: note:   'std::IO' is not derived from 'std::basic_istream<char, _Traits>'
  178 |  int n; cin >> n;
      |                ^
In file included 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 hac.cpp:1:
/usr/include/c++/10/istream:980:5: note: candidate: 'template<class _Istream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_istream<_Istream>, std::__is_extractable<typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type, _Tp&&, void> >::value, typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type>::type std::operator>>(_Istream&&, _Tp&&)'
  980 |     operator>>(_Istream&& __is, _Tp&& __x)
      |     ^~~~~~~~
/usr/include/c++/10/istream:980:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/istream: In substitution of 'template<class _Istream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_istream<_Istream>, std::__is_extractable<typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type, _Tp&&, void> >::value, typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type>::type std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::IO&; _Tp = int&]':
hac.cpp:178:16:   required from here
/usr/include/c++/10/istream:980:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
In file included from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from hac.cpp:1:
/usr/include/c++/10/complex:500:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::complex<_Tp>&)'
  500 |     operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
      |     ^~~~~~~~
/usr/include/c++/10/complex:500:5: note:   template argument deduction/substitution failed:
hac.cpp:178:16: note:   'std::IO' is not derived from 'std::basic_istream<_CharT, _Traits>'
  178 |  int n; cin >> n;
      |                ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:66,
                 from hac.cpp:1:
/usr/include/c++/10/bitset:1472:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::bitset<_Nb>&)'
 1472 |     operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
      |     ^~~~~~~~
/usr/include/c++/10/bitset:1472:5: note:   template argument deduction/substitution failed:
hac.cpp:178:16: note:   's