QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#261566#7804. Intersegment ActivationFHQY_WWW#TL 4ms3664kbC++202.6kb2023-11-22 23:56:222023-11-22 23:56:22

Judging History

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

  • [2023-11-22 23:56:22]
  • 评测
  • 测评结果:TL
  • 用时:4ms
  • 内存:3664kb
  • [2023-11-22 23:56:22]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define double long double
#define lowbit(x) x&(-x)
#define fastios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define endl '\n'
#define el puts("")
#define udm unordered_map<int,int>
#define set_0(a) memset(&a,0,sizeof(a))
#define set_unint(a) memset(&a,-1,sizeof(a))
using namespace std;
//define_var
const int M=2e5+9,inf=1e18;
bool isok[M],sign[M];
int n,k;
int pro;
//define_var
//function_begin
//int read()
//{
//	int x=0,f=1;
//	char c=getchar();
//	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
//	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
//	return x*f;
//}
//void write(int x)
//{
//	if(x<0) putchar('-'),x=-x;
//	if(x>9) write(x/10);
//	putchar(x%10+'0');
//}
int read(int i,int j)
{
	cout<<i<<" "<<j<<endl;
	int x;
	cin>>x;
	return x;
}
bool check(int x)
{
	for(int i=0;i<(1<<(n-x));i++)
		isok[i]=0;
	int now=0;
	pro=read(x,x);
	if(pro==n) return true;
	if(k!=pro)
	{
		if(pro==k-1)
		{
			k=read(x,x);
			if(k==n) return true;
		}
		else
			k=pro;
		if(pro==n)
			return true;
		else
			return false;
	}
	isok[now]=1;
	k=pro;
	while(true)
	{
		bool flag=1;
		for(int i=0;i<(1<<(n-x));i++)
			flag&=isok[i];
		if(flag)
			return false;
		for(int i=0;i<(1<<(n-x));i++)
		{
			if(isok[i]) continue;
			int ps=-1,cnt=0;
			int c1=now,c2=i;
			for(int j=0;j<(n-x);j++)
			{
				if(c1%2==c2%2)
				{
					c1/=2,c2/=2;
					continue;
				}
				cnt++;
				ps=j;
				c1/=2,c2/=2;
			}
			if(cnt==1)
			{
				isok[i]=1;
				pro=read(x,n-ps);
				if(pro==n) return true;
				if(pro!=k)
				{
					k=pro;
					for(int t=x+1;t<n;t++)
					{
						if(sign[t]) continue;
						pro=read(t,t);
						if(pro!=k)
						{
							if(pro==k-1)
							{
								k=read(t,t);
								sign[t]=1;
							}
							else
							{
								sign[t]=1;
								k=pro;
							}
						}
						k=pro;
					}
				}
				else
					k=pro;
				pro=read(x,x);
				if(pro==n) return true;
				now=i;
				if(k!=pro)
				{
					if(pro==k-1)
					{
						k=read(x,x);
						if(k==n)
							return true;
					}
					else
						k=pro;
					if(pro==n)
						return true;
					else
						return false;
				}
				k=pro;
				break;
			}
		}
	}
	return false;
}
//function_end
//solve_begin
void solve()
{
	cin>>n>>k;
	if(k==n)
		return;
	for(int i=1;i<=n;i++)
	{
		if(sign[i])
			continue;
		if(check(i))
			return;
		sign[i]=1;
	}
//	read(n,n);
	return;
}
//solve_end
//main_begin
signed main()
{
//	fastios
	int T=1;
//	cin>>T;
	while(T--)
		solve();
}
//main_end

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3552kb

input:

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

output:

1 1
1 3
1 1
1 2
1 1
1 3
1 1
2 2
2 3
2 2

result:

ok OK, 10 queries

Test #2:

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

input:

1
0
1

output:

1 1

result:

ok OK, 1 queries

Test #3:

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

input:

2
1
2

output:

1 1

result:

ok OK, 1 queries

Test #4:

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

input:

2
0
0
1
0
1
2

output:

1 1
1 2
1 1
1 1
2 2

result:

ok OK, 5 queries

Test #5:

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

input:

2
0
1
2

output:

1 1
2 2

result:

ok OK, 2 queries

Test #6:

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

input:

2
0
0
1
2

output:

1 1
1 2
1 1

result:

ok OK, 3 queries

Test #7:

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

input:

3
0
0
1
1
1
1
2
3

output:

1 1
1 3
2 2
1 1
1 2
1 1
2 2

result:

ok OK, 7 queries

Test #8:

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

input:

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

output:

1 1
1 3
1 1
1 2
1 1
2 2
2 3
2 2
2 2
3 3

result:

ok OK, 10 queries

Test #9:

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

input:

3
0
1
2
3

output:

1 1
2 2
3 3

result:

ok OK, 3 queries

Test #10:

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

input:

3
0
0
2
1
2
3

output:

1 1
1 3
2 2
2 2
1 1

result:

ok OK, 5 queries

Test #11:

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

input:

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

output:

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

result:

ok OK, 17 queries

Test #12:

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

input:

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

output:

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

result:

ok OK, 30 queries

Test #13:

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

input:

4
0
1
2
3
4

output:

1 1
2 2
3 3
4 4

result:

ok OK, 4 queries

Test #14:

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

input:

4
0
0
3
2
3
2
3
4

output:

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

result:

ok OK, 7 queries

Test #15:

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

input:

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

output:

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

result:

ok OK, 37 queries

Test #16:

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

input:

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

output:

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

result:

ok OK, 47 queries

Test #17:

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

input:

5
0
1
2
3
4
5

output:

1 1
2 2
3 3
4 4
5 5

result:

ok OK, 5 queries

Test #18:

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

input:

5
0
0
4
3
4
3
2
3
4
5

output:

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

result:

ok OK, 9 queries

Test #19:

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

input:

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

output:

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

result:

ok OK, 71 queries

Test #20:

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

input:

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

output:

1 1
1 6
1 1
1 5
1 1
1 6
1 1
1 4
1 1
1 5
1 1
1 6
1 1
1 5
1 1
1 3
1 1
1 4
1 1
1 5
1 1
1 6
1 1
1 5
1 1
1 4
1 1
1 5
1 1
1 6
1 1
1 2
1 1
1 3
1 1
1 4
1 1
1 6
1 1
1 5
1 1
1 6
1 1
1 4
1 1
1 6
1 1
1 5
1 1
1 3
1 1
1 4
1 1
1 6
1 1
1 5
1 1
1 6
1 1
1 4
1 1
1 6
2 2
3 3
4 4
5 5
1 1
1 1
2 2
2 6
2 2
2 5
2 2
2 6
2 2
...

result:

ok OK, 119 queries

Test #21:

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

input:

6
0
1
2
3
4
5
6

output:

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

result:

ok OK, 6 queries

Test #22:

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

input:

6
0
0
5
4
5
4
3
4
3
4
5
6

output:

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

result:

ok OK, 11 queries

Test #23:

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

input:

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

output:

1 1
1 7
1 1
1 6
1 1
1 7
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 6
1 1
1 4
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 6
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 3
1 1
1 4
1 1
1 5
1 1
1 7
1 1
1 6
1 1
1 7
1 1
1 5
1 1
1 7
1 1
2 2
2 7
2 2
2 6
2 2
2 7
2 2
2 5
2 2
2 6
2 2
2 7
2 2
2 6
2 2
2 4
2 2
2 5
2 2
3 3
3 7
3 3
3 6
3 3
3 7
3 3
3 5
3 3
...

result:

ok OK, 97 queries

Test #24:

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

input:

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

output:

1 1
1 7
1 1
1 6
1 1
1 7
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 6
1 1
1 4
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 6
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 3
1 1
1 4
1 1
1 5
1 1
1 7
1 1
1 6
1 1
1 7
1 1
1 5
1 1
1 7
1 1
1 6
1 1
1 4
1 1
1 5
1 1
1 7
1 1
1 6
1 1
1 7
1 1
1 5
1 1
1 7
1 1
1 2
1 1
2 2
2 7
2 2
2 6
2 2
2 7
2 2
2 5
2 2
2 6
...

result:

ok OK, 184 queries

Test #25:

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

input:

7
0
1
2
3
4
5
6
7

output:

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

result:

ok OK, 7 queries

Test #26:

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

input:

7
0
0
6
5
6
5
4
5
4
3
4
5
6
7

output:

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

result:

ok OK, 13 queries

Test #27:

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

input:

8
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

1 1
1 8
1 1
1 7
1 1
1 8
1 1
1 6
1 1
1 7
1 1
1 8
1 1
1 7
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 8
1 1
1 7
1 1
1 6
1 1
1 7
1 1
1 8
1 1
1 4
1 1
1 5
1 1
1 6
1 1
1 8
1 1
1 7
1 1
1 8
1 1
1 6
1 1
1 8
1 1
1 7
1 1
1 5
1 1
1 6
1 1
1 8
1 1
1 7
1 1
1 8
1 1
1 6
1 1
1 8
1 1
1 3
1 1
1 4
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 8
1 1
...

result:

ok OK, 418 queries

Test #28:

score: 0
Accepted
time: 3ms
memory: 3636kb

input:

8
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

1 1
1 8
1 1
1 7
1 1
1 8
1 1
1 6
1 1
1 7
1 1
1 8
1 1
1 7
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 8
1 1
1 7
1 1
1 6
1 1
1 7
1 1
1 8
1 1
1 4
1 1
1 5
1 1
1 6
1 1
1 8
1 1
1 7
1 1
1 8
1 1
1 6
1 1
1 8
1 1
1 7
1 1
1 5
1 1
1 6
1 1
1 8
1 1
1 7
1 1
1 8
1 1
1 6
1 1
1 8
1 1
1 3
1 1
1 4
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 8
1 1
...

result:

ok OK, 452 queries

Test #29:

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

input:

8
0
1
2
3
4
5
6
7
8

output:

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

result:

ok OK, 8 queries

Test #30:

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

input:

8
0
0
7
6
7
6
5
6
5
4
5
4
5
6
7
8

output:

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

result:

ok OK, 15 queries

Test #31:

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

input:

9
0
0
0
0
0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1
1 8
1 1
1 9
1 1
1 8
1 1
1 7
1 1
1 8
1 1
1 9
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 9
1 1
1 8
1 1
1 9
1 1
1 7
1 1
1 9
1 1
1 8
1 1
1 6
1 1
1 7
1 1
1 9
1 1
1 8
1 1
1 9
1 1
1 7
1 1
1 9
1 1
1 4
1 1
1 5
1 1
1 6
1 1
1 7
1 1
1 8
1 1
1 9
1 1
...

result:

ok OK, 709 queries

Test #33:

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

input:

9
0
1
2
3
4
5
6
7
8
9

output:

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

result:

ok OK, 9 queries

Test #34:

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

input:

9
0
0
8
7
8
7
6
7
6
5
6
5
4
5
6
7
8
9

output:

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

result:

ok OK, 17 queries

Test #35:

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

input:

10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

1 1
1 10
1 1
1 9
1 1
1 10
1 1
1 8
1 1
1 9
1 1
1 10
1 1
1 9
1 1
1 7
1 1
1 8
1 1
1 9
1 1
1 10
1 1
1 9
1 1
1 8
1 1
1 9
1 1
1 10
1 1
1 6
1 1
1 7
1 1
1 8
1 1
1 10
1 1
1 9
1 1
1 10
1 1
1 8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