QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#521049#8726. Magic ShowMisty7Compile Error//C++14817b2024-08-15 20:28:052024-08-15 20:28:06

Judging History

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

  • [2024-08-15 20:28:06]
  • 评测
  • [2024-08-15 20:28:05]
  • 提交

Alice

#include <bits/stdc++.h>
#include "Alice.h"

using i64 = long long;

constexpr int N = 5000;

std::vector<std::pair<int, int>> Alice () {
    i64 n = setN(N);
    std::vector<std::vector<std::pair<int, int>>> edges;
    for (int i = 1; i < n; i++) {
        edges.emplace_back(n % i + 1, i + 1);
    }
    return edges;
}

Bob

#include <bits/stdc++.h>
#include "Bob.h"

using i64 = long long;

constexpr i64 limit = 1E15;

i64 lcm (i64 a, i64 b) {
    return a / std::__gcd(a, b) * b;
}

int Bob (std::vector<std::pair<int, int>> edges) {
    i64 ans = 0, per = 0;
    for (auto [x, y] : edges) {
        x--, y--;
        while (ans % x != y) {
            ans += per;
        }
        per = lcm(per, y);
        if (per >= lim) {
            break;
        }
    }
    return ans;
}

Details

Alice.code: In function ‘std::vector<std::pair<int, int> > Alice()’:
Alice.code:14:12: error: could not convert ‘edges’ from ‘vector<std::vector<std::pair<int, int> >>’ to ‘vector<std::pair<int, int>>’
   14 |     return edges;
      |            ^~~~~
      |            |
      |            vector<std::vector<std::pair<int, int> >>
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 Alice.code:1:
/usr/include/c++/13/bits/new_allocator.h: In instantiation of ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::vector<std::pair<int, int> >; _Args = {long long int, int}; _Tp = std::vector<std::pair<int, int> >]’:
/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 = std::vector<std::pair<int, int> >; _Args = {long long int, int}; _Tp = std::vector<std::pair<int, int> >; allocator_type = std::allocator<std::vector<std::pair<int, int> > >]’
/usr/include/c++/13/bits/vector.tcc:117:30:   required from ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {long long int, int}; _Tp = std::vector<std::pair<int, int> >; _Alloc = std::allocator<std::vector<std::pair<int, int> > >; reference = std::vector<std::pair<int, int> >&]’
Alice.code:12:27:   required from here
/usr/include/c++/13/bits/new_allocator.h:187:11: error: no matching function for call to ‘std::vector<std::pair<int, int> >::vector(long long int, int)’
  187 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/stl_vector.h:704:9: note: candidate: ‘template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]’
  704 |         vector(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~
/usr/include/c++/13/bits/stl_vector.h:704:9: note:   template argument deduction/substitution failed:
/usr/include/c++/13/bits/new_allocator.h:187:11: note:   deduced conflicting types for parameter ‘_InputIterator’ (‘long long int’ and ‘int’)
  187 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:675:7: note: candidate: ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; allocator_type = std::allocator<std::pair<int, int> >]’
  675 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/13/bits/stl_vector.h:675:43: note:   no known conversion for argument 1 from ‘long long int’ to ‘std::initializer_list<std::pair<int, int> >’
  675 |       vector(initializer_list<value_type> __l,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:656:7: note: candidate: ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::__type_identity_t<_Alloc> = std::allocator<std::pair<int, int> >]’
  656 |       vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
      |       ^~~~~~
/usr/include/c++/13/bits/stl_vector.h:656:23: note:   no known conversion for argument 1 from ‘long long int’ to ‘std::vector<std::pair<int, int> >&&’
  656 |       vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
      |              ~~~~~~~~~^~~~
/usr/include/c++/13/bits/stl_vector.h:637:7: note: candidate: ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; allocator_type = std::allocator<std::pair<int, int> >; std::false_type = std::integral_constant<bool, false>]’
  637 |       vector(vector&& __rv, const allocator_type& __m, false_type)
      |       ^~~~~~
/usr/include/c++/13/bits/stl_vector.h:637:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/13/bits/stl_vector.h:632:7: note: candidate: ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::p...