QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#799021#63. MeetingsSimonLJKCompile Error//C++141021b2024-12-04 20:36:082024-12-04 20:36:09

Judging History

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

  • [2024-12-04 20:36:09]
  • 评测
  • [2024-12-04 20:36:08]
  • 提交

answer

#include "meetings.h"
#include<bits/stdc++.h>
using namespace std;
mt19937 rd(14685413);
vector<int> b[2009];
void solve(int rt,vector<int> vec){
	b[rt].clear();
	if(!vec.size()) return;
	if(vec.size()==1){ Bridge(rt,vec[0]); return; }
	shuffle(vec.begin(),vec.end());
	int nd=vec.back(); vec.pop_back();
	vector<int> sta;
	int v,w;
	for(int i=0;i<vec.size();i++){
		v=vec[i]; w=Query(rt,nd,v);
		if(w==v){ sta.push_back(v); }
		else{ b[w].push_back(v); }
	}
	int l,r,mid,re;
	for(int i=1;i<sta.size();i++){
		l=0,r=i-1,re=i;
		while(l<=r){
			mid=(l+r)/2;
			if(Query(rt,sta[mid],sta[i])==sta[i]) re=mid,l=mid-1;
			else r=mid+1;
		}
		for(int j=i;j>re;j--)
			swap(sta[j],sta[j-1]);
	}
	for(int i=1;i<sta.size();i++)
		Bridge(sta[i-1],sta[i]);
	Bridge(rt,sta[0]); Bridge(sta.back(),nd);
	for(int i=0;i<sta.size();i++)
		solve(sta[i],b[sta[i]]);
	return;
}
void solve(int N){
	int rt=rd()%N;
	for(int i=0;i<N;i++)
		if(i!=rt)
			b[rt].push_back(i);
	solve(rt,b[rt]);
	return;
}

Details

answer.code: In function ‘void solve(int, std::vector<int>)’:
answer.code:10:16: error: no matching function for call to ‘shuffle(std::vector<int>::iterator, std::vector<int>::iterator)’
   10 |         shuffle(vec.begin(),vec.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:2:
/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:10:16: note:   candidate expects 3 arguments, 2 provided
   10 |         shuffle(vec.begin(),vec.end());
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~