QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#799029#63. MeetingsSimonLJK0 3ms3988kbC++141.1kb2024-12-04 20:42:562024-12-04 20:43:03

Judging History

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

  • [2024-12-04 20:43:03]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:3988kb
  • [2024-12-04 20:42:56]
  • 提交

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; }
	random_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]);
	if(!sta.empty())
		Bridge(rt,sta[0]),Bridge(sta.back(),nd);
	else Bridge(rt,nd);
	for(int i=0;i<sta.size();i++)
		solve(sta[i],b[sta[i]]);
	solve(rt,b[rt]); solve(nd,b[nd]);
	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;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 7
Accepted
time: 0ms
memory: 3872kb

input:

3
0 2
0 1

output:

Accepted: 1

result:

ok 1 move(s)

Test #2:

score: 0
Wrong Answer
time: 3ms
memory: 3988kb

input:

4
1 2
0 2
0 3

output:

Wrong Answer [2]

result:

wrong answer 

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%