QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#782010#9807. Make Them Believeyzy_21Compile Error//C++23935b2024-11-25 18:28:532024-11-25 18:29:05

Judging History

This is the latest submission verdict.

  • [2024-11-25 18:29:05]
  • Judged
  • [2024-11-25 18:28:53]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long

struct node {
    node(string n, int v) : name(n), val(v) {};
    string name;
    int val;
};

signed main() {
    vector<node> a(9);
    for(int i = 1; i <= 8; ++i) {
        cin >> a[i].name >> a[i].val;
    }
    vector<node> b;b.emplace_back("", 0);
    for(int i = 1; i <= 8; i += 2) {
        if(a[i].val > a[i + 1].val) {
            b.emplace_back(a[i]);
        }
        else {
            b.emplace_back(a[i + 1]);
        }
    }
    vector<node> c;c.emplace_back("", 0);
    for(int i = 1; i <= 4; i += 2) {
        if(b[i].val > b[i + 1].val) {
            c.emplace_back(b[i]);
        }
        else {
            c.emplace_back(b[i + 1]);
        }
    }
    if(c[1].val > c[2].val) cout << c[1].name << " beats " << c[2].name << endl;
    else cout << c[2].name << " beats " << c[1].name << endl;
    return 0;
}

Details

In file included from /usr/include/c++/13/bits/stl_iterator.h:85,
                 from /usr/include/c++/13/bits/stl_algobase.h:67,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:1:
/usr/include/c++/13/bits/stl_construct.h: In instantiation of ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = node; _Args = {}]’:
/usr/include/c++/13/bits/stl_uninitialized.h:643:18:   required from ‘static constexpr _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = node*; _Size = long unsigned int; bool _TrivialValueType = false]’
/usr/include/c++/13/bits/stl_uninitialized.h:706:20:   required from ‘constexpr _ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = node*; _Size = long unsigned int]’
/usr/include/c++/13/bits/stl_uninitialized.h:773:44:   required from ‘constexpr _ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = node*; _Size = long unsigned int; _Tp = node]’
/usr/include/c++/13/bits/stl_vector.h:1715:36:   required from ‘constexpr void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = node; _Alloc = std::allocator<node>; size_type = long unsigned int]’
/usr/include/c++/13/bits/stl_vector.h:555:9:   required from ‘constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = node; _Alloc = std::allocator<node>; size_type = long unsigned int; allocator_type = std::allocator<node>]’
answer.code:12:21:   required from here
/usr/include/c++/13/bits/stl_construct.h:115:28: error: no matching function for call to ‘construct_at(node*&)’
  115 |           std::construct_at(__p, std::forward<_Args>(__args)...);
      |           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_construct.h:94:5: note: candidate: ‘template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...)’
   94 |     construct_at(_Tp* __location, _Args&&... __args)
      |     ^~~~~~~~~~~~
/usr/include/c++/13/bits/stl_construct.h:94:5: note:   template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_construct.h: In substitution of ‘template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = node; _Args = {}]’:
/usr/include/c++/13/bits/stl_construct.h:115:21:   required from ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = node; _Args = {}]’
/usr/include/c++/13/bits/stl_uninitialized.h:643:18:   required from ‘static constexpr _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = node*; _Size = long unsigned int; bool _TrivialValueType = false]’
/usr/include/c++/13/bits/stl_uninitialized.h:706:20:   required from ‘constexpr _ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = node*; _Size = long unsigned int]’
/usr/include/c++/13/bits/stl_uninitialized.h:773:44:   required from ‘constexpr _ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = node*; _Size = long unsigned int; _Tp = node]’
/usr/include/c++/13/bits/stl_vector.h:1715:36:   required from ‘constexpr void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = node; _Alloc = std::allocator<node>; size_type = long unsigned int]’
/usr/include/c++/13/bits/stl_vector.h:555:9:   required from ‘constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = node; _Alloc = std::allocator<node>; size_type = long unsigned int; allocator_type = std::allocator<node>]’
answer.code:12:21:   required from here
/usr/include/c++/13/bits/stl_construct.h:96:17: error: no matching function for call to ‘node::node()’
   96 |     -> decltype(::new((void*)0) _Tp(std::declval<_Args>()...))
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code:6:5: note: candidate: ‘node::node(std::string, long long int)’
    6 |     node(string n, int v) : name(n), val(v) {};
      |     ^~~~
answer.code:6:5: note:   candidate expects 2 arguments, 0 provided
answer.code:5:8: note: candidate: ‘constexpr node::node(const node&)’
    5 | struct node {
      |        ^~~~
answer.code:5:8: note:   candidate expects 1 argument, 0 provided
answer.code:5:8: note: candidate: ‘constexpr node::node(node&&)’
answer.code:5:8: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/13/bits/stl_construct.h: In instantiation of ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = node; _Args = {}]’:
/usr/include/c++/13/bits/stl_uninitialized.h:643:18:   required from ‘static constexpr _ForwardIterator std::__uniniti...