QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#743400#9432. PermutationIdtwteiAC ✓287ms4168kbC++141.6kb2024-11-13 19:07:372024-11-13 19:07:44

Judging History

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

  • [2024-11-13 19:07:44]
  • 评测
  • 测评结果:AC
  • 用时:287ms
  • 内存:4168kb
  • [2024-11-13 19:07:37]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define U(x) ((int)x.size())
const int N=1e3+10;
mt19937 rnd(time(0));
#define gc getchar()
#define rd read()
inline int read(){
	int x=0,f=0; char c=gc;
	for(;c<'0'||c>'9';c=gc) f|=(c=='-');
	for(;c>='0'&&c<='9';c=gc) x=(x<<1)+(x<<3)+(c^48);
	return f?-x:x;
}

int n,idx[N],a[N],b[N];
vector<int> cur;

inline int ask(int x,int y,int l){
	for(int i=1;i<=l;++i) b[idx[i]]=x;
	for(int i=l+1;i<=n;++i) b[idx[i]]=y;
	printf("0 "); for(int i=1;i<=n;++i) printf("%d ", b[i]); puts(""),fflush(stdout); return rd;
}
inline void over(){ printf("1 "); for(int i=1;i<=n;++i) printf("%d ", a[i]); puts(""),fflush(stdout); }

int fa[N],siz[N];
int find(int x){ return fa[x]==x?x:fa[x]=find(fa[x]); }

void sol(int l,int r,vector<int> vc){
	if(l==r){ for(int v:vc) a[idx[l]]=v; return; }
	int mid=l+r>>1; for(int v:vc) fa[v]=v,siz[v]=1; fa[n+1]=n+1,fa[n+2]=n+2,siz[n+1]=siz[n+2]=0;
	queue<int> q; for(int v:vc) q.push(v);
	while(U(q)>=2){
		int u=q.front(); q.pop();
		int v=q.front(); q.pop();
		int res=ask(u,v,mid);
		if(res==0) fa[u]=n+2,fa[v]=n+1,siz[n+1]+=siz[v],siz[n+2]+=siz[u]; 
		else if(res==1) fa[v]=u,siz[u]+=siz[v],q.push(u);
		else fa[u]=n+1,fa[v]=n+2,siz[n+1]+=siz[u],siz[n+2]+=siz[v];
	}
	if(U(q)){
		int u=q.front(); q.pop();
		fa[u]=(siz[n+1]<mid-l+1?n+1:n+2);
	}
	vector<int> v1,v2;
	for(int v:vc) if(find(v)==n+1) v1.pb(v);
	for(int v:vc) if(find(v)==n+2) v2.pb(v);
	sol(l,mid,v1),sol(mid+1,r,v2);
}

int main(){

	n=rd; for(int i=1;i<=n;++i) idx[i]=i,cur.pb(i);	
	shuffle(idx+1,idx+n+1,rnd);
	
	sol(1,n,cur),over();

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4144kb

input:

5
2
2
1
0
2
2

output:

0 1 2 2 1 1 
0 3 4 4 3 3 
0 1 3 3 1 3 
0 5 1 1 5 1 
0 3 3 3 1 3 
0 2 4 2 2 2 
1 3 4 2 1 5 

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 273ms
memory: 3864kb

input:

1000
1
1
1
2
1
2
1
1
0
1
2
0
1
1
1
1
2
0
1
2
0
1
1
1
0
2
0
1
0
1
1
0
1
0
0
0
0
2
0
1
1
1
2
2
2
1
2
2
1
1
2
1
1
0
0
2
2
2
0
0
1
1
1
0
0
2
1
2
2
2
1
1
0
1
0
1
1
1
0
2
2
0
2
1
1
0
0
0
0
1
2
1
0
1
2
2
1
0
0
1
1
1
1
2
0
2
1
1
0
1
2
1
1
0
0
1
1
2
2
0
0
0
2
1
1
0
2
1
1
0
2
1
0
0
0
1
0
1
1
1
1
2
1
1
1
1
2
1...

output:

0 1 2 1 2 1 2 1 1 1 1 1 1 2 2 1 1 1 1 1 1 2 1 2 2 2 2 1 1 1 2 2 2 2 2 1 2 1 1 2 1 1 2 1 2 2 2 1 1 2 1 1 1 1 1 2 2 2 1 1 1 1 2 1 2 2 2 2 2 1 1 2 1 1 1 2 1 1 1 2 1 1 1 2 2 2 2 1 2 1 2 2 1 1 1 1 1 1 2 2 2 2 2 1 2 1 2 2 1 1 2 2 2 1 1 2 2 2 1 2 1 2 2 1 2 1 1 2 2 2 2 2 2 2 1 1 1 2 2 2 2 1 1 1 2 1 1 1 1 2 ...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

3
0
0

output:

0 1 2 1 
0 2 3 3 
1 3 1 2 

result:

ok Accepted

Test #6:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

4
2
2
0
2

output:

0 1 2 2 1 
0 3 4 4 3 
0 1 3 3 3 
0 2 4 2 2 
1 3 4 2 1 

result:

ok Accepted

Test #7:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

6
0
1
1
0
0
0
0
0

output:

0 2 2 1 2 1 1 
0 4 4 3 4 3 3 
0 6 6 5 6 5 5 
0 5 5 3 5 3 3 
0 5 5 5 5 2 2 
0 6 6 6 6 5 6 
0 1 1 1 3 1 1 
0 4 3 3 4 3 3 
1 3 4 2 1 6 5 

result:

ok Accepted

Test #8:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

7
1
0
2
0
0
0
0
0
1
0
2

output:

0 2 2 1 1 2 1 1 
0 4 4 3 3 4 3 3 
0 6 6 5 5 6 5 5 
0 1 1 7 7 1 7 7 
0 2 2 1 2 2 1 2 
0 5 5 4 5 5 4 5 
0 5 5 5 5 5 2 5 
0 4 4 1 4 4 1 1 
0 3 6 3 3 3 3 3 
0 7 3 7 7 7 7 7 
0 3 6 3 3 6 3 3 
1 3 7 2 1 6 5 4 

result:

ok Accepted

Test #9:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

8
0
0
1
1
2
1
1
0
0
2
2
0
0
0

output:

0 2 2 1 2 1 1 1 2 
0 4 4 3 4 3 3 3 4 
0 6 6 5 6 5 5 5 6 
0 8 8 7 8 7 7 7 8 
0 7 7 5 7 5 5 5 7 
0 4 4 4 4 2 2 4 4 
0 6 6 6 6 5 5 6 6 
0 5 5 5 5 2 2 5 5 
0 6 6 6 6 5 6 6 6 
0 4 4 2 4 2 2 4 4 
0 3 3 1 1 1 1 1 1 
0 8 8 7 7 7 7 7 7 
0 8 8 1 8 1 1 1 1 
0 7 3 3 3 3 3 3 3 
1 3 7 2 1 6 5 4 8 

result:

ok Accepted

Test #10:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

9
2
0
1
0
0
0
1
0
0
2
2
1
1
0
0
0

output:

0 2 2 2 1 2 1 1 1 1 
0 4 4 4 3 4 3 3 3 3 
0 6 6 6 5 6 5 5 5 5 
0 8 8 8 7 8 7 7 7 7 
0 5 5 5 9 5 9 9 9 9 
0 4 4 4 4 4 1 1 4 1 
0 6 6 6 6 6 5 5 6 5 
0 5 5 5 5 5 8 8 5 8 
0 5 5 5 5 5 4 5 5 4 
0 6 6 6 6 6 5 6 6 6 
0 8 8 8 1 8 1 1 8 1 
0 3 2 3 2 2 2 2 2 2 
0 9 7 9 7 7 7 7 7 7 
0 7 2 7 2 2 2 2 2 2 
0 9 9 ...

result:

ok Accepted

Test #11:

score: 0
Accepted
time: 0ms
memory: 4064kb

input:

10
1
0
2
0
1
0
0
0
1
0
0
2
0
0
0
2
2

output:

0 2 2 1 2 1 1 1 1 2 2 
0 4 4 3 4 3 3 3 3 4 4 
0 6 6 5 6 5 5 5 5 6 6 
0 8 8 7 8 7 7 7 7 8 8 
0 10 10 9 10 9 9 9 9 10 10 
0 9 9 1 9 1 1 1 1 9 9 
0 5 5 4 5 4 4 5 5 5 5 
0 9 9 8 9 8 8 9 9 9 9 
0 9 9 9 9 5 5 9 9 9 9 
0 5 5 5 5 10 10 5 5 5 5 
0 9 9 9 9 5 9 9 9 9 9 
0 8 8 4 8 4 4 4 8 8 8 
0 2 1 1 2 1 1 1 1...

result:

ok Accepted

Test #12:

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

input:

11
2
0
1
0
2
0
0
1
1
2
0
2
1
0
2
1
0
0
1
0
2
2

output:

0 2 2 2 1 1 1 1 2 1 2 1 
0 4 4 4 3 3 3 3 4 3 4 3 
0 6 6 6 5 5 5 5 6 5 6 5 
0 8 8 8 7 7 7 7 8 7 8 7 
0 10 10 10 9 9 9 9 10 9 10 9 
0 5 5 5 11 11 11 11 5 11 5 11 
0 4 4 4 4 4 1 1 4 1 4 4 
0 6 6 6 6 6 5 5 6 5 6 6 
0 9 9 9 9 9 8 8 9 8 9 9 
0 8 8 8 8 8 5 5 8 5 8 8 
0 5 5 5 5 5 4 5 5 4 5 5 
0 6 6 6 6 6 5 ...

result:

ok Accepted

Test #13:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

12
1
0
2
0
0
1
0
0
1
1
2
1
0
0
1
0
2
1
0
1
2
0
0
2
2

output:

0 2 2 1 2 2 1 1 1 1 2 1 2 
0 4 4 3 4 4 3 3 3 3 4 3 4 
0 6 6 5 6 6 5 5 5 5 6 5 6 
0 8 8 7 8 8 7 7 7 7 8 7 8 
0 10 10 9 10 10 9 9 9 9 10 9 10 
0 12 12 11 12 12 11 11 11 11 12 11 12 
0 11 11 1 11 11 1 1 1 1 11 1 11 
0 5 5 4 5 5 4 5 5 5 5 4 5 
0 10 10 8 10 10 8 10 10 10 10 8 10 
0 12 12 11 12 12 11 12 1...

result:

ok Accepted

Test #14:

score: 0
Accepted
time: 1ms
memory: 3948kb

input:

13
1
0
0
0
2
0
0
2
1
1
1
0
1
1
0
2
0
0
2
2
1
1
2
2
2
1
0
0

output:

0 2 2 2 1 1 2 1 2 1 1 1 1 2 
0 4 4 4 3 3 4 3 4 3 3 3 3 4 
0 6 6 6 5 5 6 5 6 5 5 5 5 6 
0 8 8 8 7 7 8 7 8 7 7 7 7 8 
0 10 10 10 9 9 10 9 10 9 9 9 9 10 
0 12 12 12 11 11 12 11 12 11 11 11 11 12 
0 1 1 1 13 13 1 13 1 13 13 13 13 1 
0 2 2 2 1 2 2 1 2 1 2 2 1 2 
0 6 6 6 4 6 6 4 6 4 6 6 4 6 
0 9 9 9 8 9 9...

result:

ok Accepted

Test #15:

score: 0
Accepted
time: 1ms
memory: 4012kb

input:

14
1
0
0
0
0
1
0
0
2
1
1
1
0
0
0
2
0
0
2
1
1
0
1
0
1
1
2
0
0
1
0
0

output:

0 2 2 1 2 2 1 1 1 1 2 1 1 2 2 
0 4 4 3 4 4 3 3 3 3 4 3 3 4 4 
0 6 6 5 6 6 5 5 5 5 6 5 5 6 6 
0 8 8 7 8 8 7 7 7 7 8 7 7 8 8 
0 10 10 9 10 10 9 9 9 9 10 9 9 10 10 
0 12 12 11 12 12 11 11 11 11 12 11 11 12 12 
0 14 14 13 14 14 13 13 13 13 14 13 13 14 14 
0 11 11 1 11 11 1 1 1 1 11 1 1 11 11 
0 6 6 4 6 ...

result:

ok Accepted

Test #16:

score: 0
Accepted
time: 1ms
memory: 3884kb

input:

15
1
1
0
0
2
0
1
0
2
2
0
2
0
1
1
0
2
0
1
1
0
2
2
0
1
1
1
0
1
1
2
0
2
2
0

output:

0 2 2 2 1 1 2 1 2 1 1 1 1 1 2 2 
0 4 4 4 3 3 4 3 4 3 3 3 3 3 4 4 
0 6 6 6 5 5 6 5 6 5 5 5 5 5 6 6 
0 8 8 8 7 7 8 7 8 7 7 7 7 7 8 8 
0 10 10 10 9 9 10 9 10 9 9 9 9 9 10 10 
0 12 12 12 11 11 12 11 12 11 11 11 11 11 12 12 
0 14 14 14 13 13 14 13 14 13 13 13 13 13 14 14 
0 1 1 1 15 15 1 15 1 15 15 15 15...

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 261ms
memory: 3880kb

input:

975
1
0
0
0
1
0
0
2
0
2
2
1
2
1
2
2
1
2
2
0
1
1
1
1
1
0
1
0
0
1
1
2
0
0
0
2
1
0
1
2
1
2
2
1
1
1
0
2
1
2
1
1
1
2
1
0
1
1
1
2
2
1
0
1
0
1
2
0
1
2
1
1
2
0
1
1
2
1
2
2
0
2
2
1
2
1
0
0
2
2
1
0
0
2
1
1
1
1
2
1
0
2
1
0
0
1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 2 1 1 1 1 1 1 1 ...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 256ms
memory: 3904kb

input:

977
2
2
1
1
1
1
1
0
0
2
1
0
0
2
1
1
1
1
1
0
1
0
2
0
1
1
2
1
1
1
1
0
1
2
2
2
1
1
1
1
1
0
1
0
1
1
2
2
0
0
1
2
2
0
2
1
0
1
2
1
1
1
1
0
2
1
1
1
1
1
2
1
2
1
0
2
1
2
1
2
1
0
1
1
2
1
1
1
1
1
2
1
0
1
1
1
0
2
2
2
2
0
2
0
1
1
1
0
2
0
1
2
1
0
1
1
2
1
1
1
1
0
0
1
1
1
0
2
1
0
1
0
1
2
1
2
1
1
2
1
0
0
1
0
1
1
1
1
...

output:

0 1 1 2 1 2 1 1 2 2 2 2 1 1 2 1 2 1 2 2 1 2 2 1 2 2 2 2 2 2 2 2 1 1 2 1 2 2 2 2 2 1 1 1 1 2 2 1 1 1 1 1 1 2 1 1 1 2 1 1 2 2 1 1 2 1 2 1 1 1 1 2 1 1 2 2 1 2 2 1 1 2 1 1 1 1 1 2 2 2 2 1 1 1 2 1 2 1 1 2 2 1 1 1 2 2 2 2 1 2 1 1 2 1 2 2 2 1 1 2 1 1 1 1 1 2 1 2 1 2 1 1 2 1 2 1 2 1 1 2 2 2 1 1 1 2 2 2 2 1 ...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 265ms
memory: 3824kb

input:

978
1
2
1
1
2
1
1
1
1
1
1
0
2
0
1
2
1
0
0
2
2
1
1
0
1
2
1
0
2
0
2
1
1
1
2
1
0
1
1
1
1
0
1
2
1
2
2
1
1
1
2
0
0
1
2
0
1
2
0
1
1
0
0
1
1
1
1
1
2
2
1
2
2
2
2
1
2
1
1
1
2
1
0
0
0
2
1
1
2
1
0
1
1
0
2
1
1
1
2
0
1
1
0
0
0
0
0
0
1
2
0
1
2
2
1
1
1
0
1
1
1
2
0
0
0
0
0
0
0
1
1
1
1
1
0
1
1
2
1
0
2
1
1
0
2
1
1
0
...

output:

0 1 2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2 1 1 1 2 ...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 262ms
memory: 3824kb

input:

988
0
1
1
0
2
1
0
1
1
1
2
0
2
0
0
2
1
0
0
2
2
0
1
0
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
2
2
1
1
1
1
2
2
1
2
0
1
2
1
2
1
0
2
1
2
2
2
2
2
0
1
1
0
2
1
1
2
0
1
1
1
0
1
1
1
1
1
1
1
0
1
0
0
0
1
1
1
1
1
0
1
0
1
0
1
0
1
2
1
1
1
1
1
1
0
0
1
0
0
0
1
1
2
1
1
1
1
2
0
2
2
1
2
1
2
0
1
0
1
1
1
0
1
2
2
1
2
2
1
0
2
2
1
1
...

output:

0 2 2 2 1 1 1 1 2 2 1 2 2 1 2 1 1 2 2 1 1 1 2 1 1 2 1 1 2 1 2 1 2 2 2 2 2 1 1 1 2 2 2 2 2 1 2 1 1 2 1 1 1 2 1 1 1 2 2 2 2 2 1 2 2 1 2 1 1 1 1 2 1 2 1 1 1 2 1 1 1 2 2 2 1 1 2 2 1 1 2 1 1 2 2 2 2 1 2 1 1 2 1 1 2 1 2 1 1 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 1 2 1 2 1 2 2 2 1 1 2 1 2 1 1 2 2 2 2 1 2 ...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 264ms
memory: 3728kb

input:

989
1
1
2
2
0
0
1
2
1
2
1
2
1
1
1
1
2
2
1
1
1
2
2
1
2
0
2
0
2
1
2
1
1
1
1
1
1
1
0
2
1
0
0
1
0
0
0
1
1
2
2
1
2
1
1
2
0
1
1
2
2
1
2
2
1
0
1
1
1
1
1
1
2
2
1
1
1
1
2
1
0
0
1
2
1
2
2
0
2
0
2
1
1
1
1
0
1
0
0
0
1
2
1
1
1
0
2
0
1
1
2
1
0
1
1
2
2
2
2
1
1
1
0
2
0
2
2
2
1
2
1
1
2
0
1
2
1
0
1
0
0
0
1
2
2
1
0
2
...

output:

0 2 2 2 1 1 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