QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#302974#7804. Intersegment ActivationPhantomThreshold#RE 1ms3660kbC++201.0kb2024-01-11 16:22:042024-01-11 16:22:04

Judging History

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

  • [2024-01-11 16:22:04]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3660kb
  • [2024-01-11 16:22:04]
  • 提交

answer

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

const int maxn = 20;

vector<int>V[maxn];
void build()
{
	V[1].push_back(0);
	V[1].push_back(1);
	for(int i=2;i<=10;i++)
	{
		for(int j=0,uj=(int)V[i-1].size();j<uj;j++)
			V[i].push_back( V[i-1][j] );
		for(int uj=(int)V[i-1].size(),j=uj-1;j>=0;j--)
			V[i].push_back( V[i-1][j]|1<<(i-1) );
	}
}
void cov(int l,int r) { cout<<l<<' '<<r<<endl; }
int n;

int main()
{
	ios_base::sync_with_stdio(false);
	
	// 31-__builtin_clz(x);
	
	build();
	
	cin>>n;
	int pos=0,now=0,ini=0;
	int chk=0;
	while(1)
	{
		int k; cin>>k;
		if(k==n) break;
		
		if(ini)
		{
			cov(1,n);
			ini=0;
			continue;
		}
		
		if(k>=pos+1)
		{
			if( !chk )
			{
				chk=1;
				cov(pos+1,n);
				continue;
			}
			else
			{
				pos++;
				now=0;
				chk=0;
				cov(1,n);
				ini=1;
				continue;
			}
		}
		else
		{
			now++;
			int j= 31-__builtin_clz( V[n-pos][now]^V[n-pos][now-1] );
			cov(pos+1,pos+1+j);
			continue;
		}
	}
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok OK, 12 queries

Test #2:

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

input:

1
0
1

output:

1 1

result:

ok OK, 1 queries

Test #3:

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

input:

2
1
0
0
2

output:

1 2
1 1
1 2

result:

ok OK, 3 queries

Test #4:

score: -100
Runtime Error

input:

2
0
0
1
0
0
0

output:

1 1
1 2
1 2
1 1
1 2
1 -569

result: