QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#875464#2745. Mechanical DollAlimkhanCompile Error//C++231.1kb2025-01-29 20:31:082025-01-29 20:31:09

Judging History

This is the latest submission verdict.

  • [2025-01-29 20:31:09]
  • Judged
  • [2025-01-29 20:31:08]
  • Submitted

answer

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

using namespace std;

#define ll long long
#define ff first
#define ss second

const int maxn = 1e6 + 10;

int n, s, a[maxn], pw, l;
vector <int> X, Y;
vector <int> c;
map <int, int> lf, rg;

void get(int v, int tl, int tr) {
	int tm = (tl + tr) / 2;
	if (tm <= l) {
		lf[v] = -1;
	}
	if (tm + 1 == tr) {
		rg[v] = a[tr];
	} else {
		s--;
		rg[v] = s;
		get(s, tm + 1, tr);
	}
	if (tl == tm && lf[v] == 0) {
		lf[v] = a[tl];
	} else {
		if (lf[v] == 0) {
			s--;
			lf[v] = s;
			get(s, tl, tm);
		}
	}
}

void create_circuit(int M, std::vector<int> A) {
	n = A.size();
	pw = 2;
	while(pw < n) {
		pw *= 2;
	}
	while(l + n < pw) {
		l++;
		a[l] = -1;
	}
	int id = l + 1;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			a[id] = A[i];
			id++;
		}
	}
	for (int i = 0; i < n; i++) {
		if (i % 2 != 0) {
			a[id] = A[i];
			id++;
		}
	}
	s = -1;
	get(1, pw);
	for (int i = 0; i < n - 1; i++) {
		c.push_back(-1);
	}
	c.push_back(0);
	for (int i = -1; i >= s; i--) {
		X.push_back(lf[i]);
		Y.push_back(rg[i]);
	}
	answer(c, X, Y);
}

详细

answer.code: In function ‘void create_circuit(int, std::vector<int>)’:
answer.code:64:12: error: no matching function for call to ‘get(int, int&)’
   64 |         get(1, pw);
      |         ~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/vector:62,
                 from doll.h:1,
                 from answer.code:1:
/usr/include/c++/14/bits/stl_pair.h:1250:5: note: candidate: ‘template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(pair<_Tp1, _Tp2>&)’
 1250 |     get(pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1250:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_pair.h:1255:5: note: candidate: ‘template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(pair<_Tp1, _Tp2>&&)’
 1255 |     get(pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1255:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_pair.h:1260:5: note: candidate: ‘template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const pair<_Tp1, _Tp2>&)’
 1260 |     get(const pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1260:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_pair.h:1265:5: note: candidate: ‘template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const pair<_Tp1, _Tp2>&&)’
 1265 |     get(const pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1265:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/bits/uses_allocator_args.h:39,
                 from /usr/include/c++/14/bits/memory_resource.h:41,
                 from /usr/include/c++/14/vector:87:
/usr/include/c++/14/tuple:2443:5: note: candidate: ‘template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(tuple<_Elements ...>&)’
 2443 |     get(tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/14/tuple:2443:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/tuple:2449:5: note: candidate: ‘template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const tuple<_Elements ...>&)’
 2449 |     get(const tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/14/tuple:2449:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/tuple:2455:5: note: candidate: ‘template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(tuple<_Elements ...>&&)’
 2455 |     get(tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/14/tuple:2455:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/tuple:2464:5: note: candidate: ‘template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const tuple<_Elements ...>&&)’
 2464 |     get(const tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/14/tuple:2464:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/functional:65,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from answer.code:2:
/usr/include/c++/14/array:390:5: note: candidate: ‘template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(array<_Tp, _Nm>&)’
  390 |     get(array<_Tp, _Nm>& __arr) noexcept
      |     ^~~
/usr/include/c++/14/array:390:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/array:399:5: note: candidate: ‘template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(array<_Tp, _Nm>&&)’
  399 |     get(array<_Tp, _Nm>&& __arr) noexcept
      |     ^~~
/usr/include/c++/14/array:399:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/array:408:5: note: candidate: ‘template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const array<_Tp, _Nm>&)’
  408 |     get(const array<_Tp, _Nm>& __arr) noexcept
      |     ^~~
/usr/include/c++/14/array:408:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/array:417:5: note: candidate: ‘template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const array<_Tp, _Nm>&&)’
  417 |     get(const array<_Tp, _Nm>&& __arr) noexcept
      |     ^~~
/usr/include/c++/14/array:417:5: not...