답안 #133940

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
133940 2019-07-21T18:40:31 Z egorlifar 운세 보기 2 (JOI14_fortune_telling2) C++17
컴파일 오류
0 ms 0 KB
/*
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>


using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left224
#define right right224
#define next next224
#define rank rank224
#define prev prev224
#define y1 y1224
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
#define mp make_pair
const string FILENAME = "input";
const int MAXN = 200228;
const int INF = 1e9;


typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


int n, k;
int a[MAXN], b[MAXN];
pair<int, int> p[MAXN];


struct rmq
{
    vector<int> d;
    int ss = 1;
    void init(int n) {
        while (ss < n) {
            ss <<= 1;
        }
        d.resize(2 * ss);
        for (int i = 0; i < 2 * ss; i++) {
            d[i] = -INF;
        }
    }
    void upd(int i, int val) {
        d[i] = val;
        while (i >> 1 > 0) {
            i >>= 1;
            d[i] = d[i * 2] + d[i * 2 + 1];
        }
    }
    int get(int l, int r) {
        l += ss;
        r += ss;
        int res = -INF;
        while (l <= r) {
            if (l & 1) {
                chkmax(res, d[l]);
                l++;
            }
            if (!(r & 1)) {
                chkmax(res, d[r]);
                r--;
            }
            l >>= 1;
            r >>= 1;
        }
        return res;
    }
};


rmq kek;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //read(FILENAME);
    cin >> n >> k;
    vector<int> vx;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        vx.pb(a[i]);
        vx.pb(b[i]);
    }
    vx.pb(1e9 + 50);
    sort(all(vx));
    vx.resize(distance(vx.begin(), unique(all(vx))));
    for (int i = 0; i < n; i++) {
        a[i] = lower_bound(all(vx), a[i]) - vx.begin();
        b[i] = lower_bound(all(vx), b[i]) - vx.begin();
    }
    kek.init(sz(vx));
    vector<pair<int, int> > st;
    for (int i = 0; i < k; i++) {
        int t;
        cin >> t;
        int uk = upper_bound(all(st), t) - st.begin();
        kek.upd(uk, i);
        st.pb({uk, i});
    }
    sort(all(st));
    for (int i = 0; i < n; i++) {
        p[i] = {a[i], b[i]};
    }
    sort(p, p + n, [](pair<int, int> a, pair<int, int> b){return max(a.first, a.second) > max(b.first, b.second);});
    long long ans = 0;
    ordered_set certain;
    for (int i = 0; i < n; i++) {
        int mn = min(p[i].first, p[i].second);
        int mx = max(p[i].first, p[i].second);
        while (sz(st) && st.back().first >= mx){
            certain.insert(st.back().second);
            st.pop_back();
        }
        int lastBetween = kek.get(mn, mx - 1);
        int remainingFlip = (sz(certain) - certain.order_of_key(lastBetween)) % 2;
        int id;
        if (lastBetween == -INF) {
            id = (remainingFlip ? p[i].second: p[i].first);
        }  else {
            id = (remainingFlip ? mn: mx);
        }
        ans += vx[id];
    }
    cout << ans << endl;
    return 0;
}

Compilation message

fortune_telling2.cpp:65:9: error: 'tree' does not name a type; did you mean 'free'?
 typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
         ^~~~
         free
fortune_telling2.cpp: In function 'int main()':
fortune_telling2.cpp:151:5: error: 'ordered_set' was not declared in this scope
     ordered_set certain;
     ^~~~~~~~~~~
fortune_telling2.cpp:156:13: error: 'certain' was not declared in this scope
             certain.insert(st.back().second);
             ^~~~~~~
fortune_telling2.cpp:160:33: error: 'certain' was not declared in this scope
         int remainingFlip = (sz(certain) - certain.order_of_key(lastBetween)) % 2;
                                 ^
fortune_telling2.cpp:46:21: note: in definition of macro 'sz'
 #define sz(c) (int)(c).size()
                     ^
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_less_iter::operator()(_Value&, _Iterator) const [with _Value = const int; _Iterator = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >]':
/usr/include/c++/7/bits/stl_algo.h:2052:14:   required from '_ForwardIterator std::__upper_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >; _Tp = int; _Compare = __gnu_cxx::__ops::_Val_less_iter]'
/usr/include/c++/7/bits/stl_algo.h:2086:32:   required from '_FIter std::upper_bound(_FIter, _FIter, const _Tp&) [with _FIter = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >; _Tp = int]'
fortune_telling2.cpp:141:40:   required from here
/usr/include/c++/7/bits/predefined_ops.h:90:22: error: no match for 'operator<' (operand types are 'const int' and 'std::pair<int, int>')
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/stl_iterator.h:888:5: note: candidate: template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)
     operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:888:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/stl_iterator.h:895:5: note: candidate: template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
     operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:895:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/stack:61:0,
                 from fortune_telling2.cpp:36:
/usr/include/c++/7/bits/stl_stack.h:311:5: note: candidate: template<class _Tp, class _Seq> bool std::operator<(const std::stack<_Tp, _Seq>&, const std::stack<_Tp, _Seq>&)
     operator<(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
     ^~~~~~~~
/usr/include/c++/7/bits/stl_stack.h:311:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::stack<_Tp, _Seq>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/queue:64:0,
                 from fortune_telling2.cpp:35:
/usr/include/c++/7/bits/stl_queue.h:336:5: note: candidate: template<class _Tp, class _Seq> bool std::operator<(const std::queue<_Tp, _Seq>&, const std::queue<_Tp, _Seq>&)
     operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
     ^~~~~~~~
/usr/include/c++/7/bits/stl_queue.h:336:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::queue<_Tp, _Seq>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/deque:64:0,
                 from /usr/include/c++/7/queue:60,
                 from fortune_telling2.cpp:35:
/usr/include/c++/7/bits/stl_deque.h:2276:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator<(const std::deque<_Tp, _Alloc>&, const std::deque<_Tp, _Alloc>&)
     operator<(const deque<_Tp, _Alloc>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_deque.h:2276:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::deque<_Tp, _Alloc>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/deque:64:0,
                 from /usr/include/c++/7/queue:60,
                 from fortune_telling2.cpp:35:
/usr/include/c++/7/bits/stl_deque.h:301:5: note: candidate: template<class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR> bool std::operator<(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _RefR, _PtrR>&)
     operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_deque.h:301:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::_Deque_iterator<_Tp, _Ref, _Ptr>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/deque:64:0,
                 from /usr/include/c++/7/queue:60,
                 from fortune_telling2.cpp:35:
/usr/include/c++/7/bits/stl_deque.h:293:5: note: candidate: template<class _Tp, class _Ref, class _Ptr> bool std::operator<(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _Ref, _Ptr>&)
     operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_deque.h:293:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::_Deque_iterator<_Tp, _Ref, _Ptr>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/list:63:0,
                 from fortune_telling2.cpp:31:
/usr/include/c++/7/bits/stl_list.h:1918:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator<(const std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&)
     operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
     ^~~~~~~~
/usr/include/c++/7/bits/stl_list.h:1918:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::__cxx11::list<_Tp, _Alloc>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/map:62:0,
                 from fortune_telling2.cpp:28:
/usr/include/c++/7/bits/stl_multimap.h:1078:5: note: candidate: template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const std::multimap<_Key, _Tp, _Compare, _Alloc>&, const std::multimap<_Key, _Tp, _Compare, _Alloc>&)
     operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_multimap.h:1078:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::multimap<_Key, _Tp, _Compare, _Alloc>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/map:61:0,
                 from fortune_telling2.cpp:28:
/usr/include/c++/7/bits/stl_map.h:1412:5: note: candidate: template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const std::map<_Key, _Tp, _Compare, _Alloc>&, const std::map<_Key, _Tp, _Compare, _Alloc>&)
     operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_map.h:1412:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::map<_Key, _Tp, _Compare, _Alloc>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/bits/stl_map.h:63:0,
                 from /usr/include/c++/7/map:61,
                 from fortune_telling2.cpp:28:
/usr/include/c++/7/tuple:1410:5: note: candidate: template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const std::tuple<_Tps ...>&, const std::tuple<_Args2 ...>&)
     operator<(const tuple<_TElements...>& __t,
     ^~~~~~~~
/usr/include/c++/7/tuple:1410:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::tuple<_Tps ...>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/bits/stl_map.h:63,
                 from /usr/include/c++/7/map:61,
                 from fortune_telling2.cpp:28:
/usr/include/c++/7/array:262:5: note: candidate: template<class _Tp, long unsigned int _Nm> bool std::operator<(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)
     operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
     ^~~~~~~~
/usr/include/c++/7/array:262:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/set:62:0,
                 from fortune_telling2.cpp:27:
/usr/include/c++/7/bits/stl_multiset.h:913:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator<(const std::multiset<_Key, _Compare, _Alloc>&, const std::multiset<_Key, _Compare, _Alloc>&)
     operator<(const multiset<_Key, _Compare, _Alloc>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_multiset.h:913:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::multiset<_Key, _Compare, _Alloc>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/set:61:0,
                 from fortune_telling2.cpp:27:
/usr/include/c++/7/bits/stl_set.h:930:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator<(const std::set<_Key, _Compare, _Alloc>&, const std::set<_Key, _Compare, _Alloc>&)
     operator<(const set<_Key, _Compare, _Alloc>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_set.h:930:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::set<_Key, _Compare, _Alloc>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/set:60:0,
                 from fortune_telling2.cpp:27:
/usr/include/c++/7/bits/stl_tree.h:1543:5: note: candidate: template<class _Key, class _Val, class _KeyOfValue, class _Compare, class _Alloc> bool std::operator<(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&, const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)
     operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_tree.h:1543:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from fortune_telling2.cpp:17:
/usr/include/c++/7/bits/predefined_ops.h:90:22: note:   mismatched types 'const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>' and 'const int'
       { return __val < *__it; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/bits/node_handle.h:39:0,
                 from /usr/include/c++/7/bits/stl_tree.h:72,
                 from /usr/include/c++/7/set:60,
                 from fortune_telling2.cpp:27:
/usr/include/c++/7/optional:934:5: note: candidate: template<class _Tp, class _Up> constexpr std::__optional_relop_t<decltype ((declval<_Up>() < declval<_Tp>()))> std::operator<(const _Up&, const std::optional<_Tp>&)
     operator<(const _Up& __lhs, const optional<_Tp>& __rhs)
     ^~~~~~~~
/usr/include/c++/7/optional:934:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7