QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#781999#9807. Make Them Believeyzy_21Compile Error//C++14892b2024-11-25 18:26:572024-11-25 18:26:59

Judging History

你现在查看的是最新测评结果

  • [2024-11-25 18:26:59]
  • 评测
  • [2024-11-25 18:26:57]
  • 提交

answer

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

struct node {
    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(node{"", 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/x86_64-linux-gnu/c++/13/bits/c++allocator.h:33,
                 from /usr/include/c++/13/bits/allocator.h:46,
                 from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from answer.code:1:
/usr/include/c++/13/bits/new_allocator.h: In instantiation of ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = node; _Args = {const char (&)[1], int}; _Tp = node]’:
/usr/include/c++/13/bits/alloc_traits.h:537:17:   required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = node; _Args = {const char (&)[1], int}; _Tp = node; allocator_type = std::allocator<node>]’
/usr/include/c++/13/bits/vector.tcc:117:30:   required from ‘void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {const char (&)[1], int}; _Tp = node; _Alloc = std::allocator<node>]’
answer.code:24:34:   required from here
/usr/include/c++/13/bits/new_allocator.h:187:11: error: no matching function for call to ‘node::node(const char [1], int)’
  187 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code:5:8: note: candidate: ‘node::node()’
    5 | struct node {
      |        ^~~~
answer.code:5:8: note:   candidate expects 0 arguments, 2 provided
answer.code:5:8: note: candidate: ‘node::node(const node&)’
answer.code:5:8: note:   candidate expects 1 argument, 2 provided
answer.code:5:8: note: candidate: ‘node::node(node&&)’
answer.code:5:8: note:   candidate expects 1 argument, 2 provided