QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#307510#5015. 树Harry27182Compile Error//C++14613b2024-01-18 19:05:392024-01-18 19:05:39

Judging History

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

  • [2024-01-18 19:05:39]
  • 评测
  • [2024-01-18 19:05:39]
  • 提交

answer

#include<bits/stdc++.h>
#include "tree.h"
using namespace std;
int dep[1005];vector<int>v[1005];
void solver(int n, int A, int B)
{
	dep[1]=0;
	for(int i=2;i<=n;i++)
	{
		vector<int>now;now.emplace_back(now);
		dep[i]=ask(1,now);
		v[dep[i]].emplace_back(i);
		if(dep[i]==1)answer(1,i); 
	}
	for(int i=1;i<=n;i++)shuffle(v[i].begin(),v[i].end());
	for(int i=2;i<=n;i++)
	{
		for(int j=0;j<v[i].size();j++)
		{
			int x=v[i][j];
			for(int k=0;k<v[i-1].size();k++)
			{
				vector<int>now;
				now.emplace_back(v[i-1][k]);
				if(ask(x,now)==1){answer(x,v[i-1][k]);break;}
			}
		}
	}
}

Details

implementer.cpp: In function ‘void regduj260135279::init()’:
implementer.cpp:32:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   32 |                 scanf("%d",&n);
      |                 ~~~~~^~~~~~~~~
implementer.cpp:45:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   45 |                         scanf("%d%d",&u,&v);
      |                         ~~~~~^~~~~~~~~~~~~~
answer.code: In function ‘void solver(int, int, int)’:
answer.code:15:37: error: no matching function for call to ‘shuffle(std::vector<int>::iterator, std::vector<int>::iterator)’
   15 |         for(int i=1;i<=n;i++)shuffle(v[i].begin(),v[i].end());
      |                              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:1:
/usr/include/c++/13/bits/stl_algo.h:3742:5: note: candidate: ‘template<class _RAIter, class _UGenerator> void std::shuffle(_RAIter, _RAIter, _UGenerator&&)’
 3742 |     shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~~~~
/usr/include/c++/13/bits/stl_algo.h:3742:5: note:   template argument deduction/substitution failed:
answer.code:15:37: note:   candidate expects 3 arguments, 2 provided
   15 |         for(int i=1;i<=n;i++)shuffle(v[i].begin(),v[i].end());
      |                              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
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:
/usr/include/c++/13/bits/new_allocator.h: In instantiation of ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = int; _Args = {std::vector<int, std::allocator<int> >&}; _Tp = 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 = int; _Args = {std::vector<int, std::allocator<int> >&}; _Tp = int; allocator_type = std::allocator<int>]’
/usr/include/c++/13/bits/vector.tcc:117:30:   required from ‘void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {std::vector<int, std::allocator<int> >&}; _Tp = int; _Alloc = std::allocator<int>]’
answer.code:10:34:   required from here
/usr/include/c++/13/bits/new_allocator.h:187:11: error: cannot convert ‘std::vector<int>’ to ‘int’ in initialization
  187 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~