QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#20288#2425. The Collection GameXiao_Luo_Xuan0 135ms3848kbC++201.2kb2022-02-15 12:11:342022-05-03 09:28:10

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-03 09:28:10]
  • 评测
  • 测评结果:0
  • 用时:135ms
  • 内存:3848kb
  • [2022-02-15 12:11:34]
  • 提交

answer

#include<bits/stdc++.h>
#include "swaps.h"
using namespace std;
int ans[550],anss[550];
int n;

void cmp(int x,int y,int dir,int s){
	if(x>n && y>n) return ;
	else if(x>n){
		if(!dir) swap(ans[x],ans[y]);
		return ; 
	}
	else if(y>n){
		if(dir) swap(ans[x],ans[y]);
		return ;
	}
	else{
		if(dir!=s) swap(ans[x],ans[y]);
		return ;
	}
}

int tmp[550],asw[550],id;

void merge(int l,int r,int dir){
	if(l==r) return ;
	int mid=(l+r)>>1;
	
	id=0;
	for(int i=l;i<=mid;i++){
		int x=i,y=i+(mid-l+1);
		if(x>n || y>n) continue;
		schedule(ans[x],ans[y]);
		tmp[id++]=i;
	}
	vector <int> v=visit();
	for(int i=0;i<id;i++){
		asw[tmp[i]]=v[i];
	}
	for(int i=l;i<=mid;i++){
		int x=i,y=i+(mid-l+1);
		cmp(x,y,dir,asw[i]);
	}
	merge(l,mid,dir);
	merge(mid+1,r,dir);
}


void CDQ(int l,int r,int dir){
	if(l==r) return ;
	int mid=(l+r)>>1;
	CDQ(l,mid,dir);
	CDQ(mid+1,r,dir^1);
	merge(l,r,dir);
}

void solve(int nn, int V) {
	n=nn;
	int lim=1;
	while(lim<n) lim<<=1;
	for(int i=1;i<=lim;i++) ans[i]=i;
	CDQ(1,lim,1);
	
//	for(int i=1;i<=lim;i++) cout<<ans[i]<<" ";
//	cout<<endl;
	vector <int> ANS;
	for(int i=1;i<=lim;i++) ANS.push_back(ans[i]);
	answer(ANS);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Accepted

Test #1:

score: 0
Accepted
time: 4ms
memory: 3828kb

input:

4 50
1 0
1 0
2 1 0
1 0
1 1

output:

946149565 1 2
547293220
946149565 3 4
547293220
946149565 2 3
946149565 1 4
547293220
946149565 2 4
547293220
946149565 3 1
547293220
345685428 4 2 3 1

result:

points 1.0 points  1.0 Correct

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 7ms
memory: 3812kb

input:

10 5000
1 0
1 0
2 1 0
1 0
1 1
1 0
1 0
2 0 1
1 1
1 0
4 1 1 1 0
2 1 0
1 0
1 0
2 0 1
1 1
1 1
1 0
0
0
1 0
0
0
0
0
0
0
0
0
1 0
0
0
0
0
2 1 1

output:

946149565 1 2
547293220
946149565 3 4
547293220
946149565 2 3
946149565 1 4
547293220
946149565 2 4
547293220
946149565 3 1
547293220
946149565 5 6
547293220
946149565 7 8
547293220
946149565 5 8
946149565 6 7
547293220
946149565 5 7
547293220
946149565 8 6
547293220
946149565 4 7
946149565 2 5
9461...

result:

points 0.0 points  0.0 Not correct

Subtask #3:

score: 0
Wrong Answer

Test #10:

score: 0
Wrong Answer
time: 135ms
memory: 3848kb

input:

500 1000
1 0
1 0
2 1 0
1 1
1 1
1 0
1 1
2 0 1
1 1
1 1
4 1 1 0 0
2 1 0
1 0
1 1
2 1 1
1 0
1 1
1 0
1 0
2 0 1
1 0
1 0
1 1
1 0
2 1 0
1 0
1 1
4 0 0 1 1
2 0 0
1 0
1 1
2 0 0
1 1
1 0
8 1 1 1 1 0 0 0 0
4 1 1 1 1
2 1 1
1 1
1 1
2 0 0
1 0
1 0
4 0 0 1 1
2 1 1
1 1
1 0
2 1 1
1 0
1 1
1 0
1 1
2 0 0
1 0
1 1
1 0
1 1
2 1...

output:

946149565 1 2
547293220
946149565 3 4
547293220
946149565 2 3
946149565 1 4
547293220
946149565 2 4
547293220
946149565 3 1
547293220
946149565 5 6
547293220
946149565 7 8
547293220
946149565 5 7
946149565 6 8
547293220
946149565 5 8
547293220
946149565 7 6
547293220
946149565 2 8
946149565 4 5
9461...

result:

points 0.0 points  0.0 Not correct

Subtask #4:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 7ms
memory: 3824kb

input:

10 5000
1 1
1 1
2 1 1
1 1
1 1
1 1
1 1
2 1 1
1 1
1 1
4 1 1 1 1
2 1 1
1 1
1 1
2 1 1
1 1
1 1
1 1
0
0
1 1
0
0
0
0
0
0
0
0
1 1
0
0
0
0
2 1 1

output:

946149565 1 2
547293220
946149565 3 4
547293220
946149565 1 4
946149565 2 3
547293220
946149565 1 2
547293220
946149565 4 3
547293220
946149565 5 6
547293220
946149565 7 8
547293220
946149565 6 7
946149565 5 8
547293220
946149565 7 8
547293220
946149565 6 5
547293220
946149565 1 8
946149565 2 7
9461...

result:

points 0.0 points  0.0 Not correct

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #4:

0%

Subtask #7:

score: 0
Skipped

Dependency #2:

0%

Subtask #8:

score: 0
Skipped

Dependency #4:

0%

Subtask #9:

score: 0
Skipped

Dependency #3:

0%

Subtask #10:

score: 0
Skipped

Dependency #8:

0%

Subtask #11:

score: 0
Skipped

Dependency #9:

0%

Subtask #12:

score: 0
Skipped

Dependency #10:

0%

Subtask #13:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%