比赛 果蝇王邀请赛div2 评测结果 WTTTTTTTTT
题目名称 果蝇炸弹 最终得分 0
用户昵称 dream 运行时间 9.945 s
代码语言 C++ 内存使用 9.14 MiB
提交时间 2026-08-27 12:55:39
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=300005;
int n;
int b[N],c[N];
ll ans;
struct node{
	ll a,r;
	bool operator<(const node &t) const{
		if(a!=t.a) return a<t.a;
		return r>t.r;
	}
}infor[N];
void work(){
	int bj=0;
	for(int i=1;i<=n;i++){
		node ti=infor[i];
		if(b[i]){
			for(int j=1;j<=n;j++){
				node tj=infor[j];
				if(ti.a+ti.r>=tj.a&&ti.a-ti.r<=tj.a){
					b[j]=1;
				}
			}		
		}
	}
	for(int i=1;i<=n;i++){
		bj=bj*2+b[i];
	}
	if(!c[bj]){
		c[bj]=1;
		ans++;
	}
}
void dfs(int x){
	if(x>n){
		work();
		return;
	}
	b[x]=0;
	dfs(x+1);
	b[x]=1;
	dfs(x+1); 
}
int main(){
	freopen("bombmine.in","r",stdin);
	freopen("bombmine.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int cc;
	cin>>cc;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>infor[i].a>>infor[i].r;
	}
	dfs(1);
	cout<<ans-1;
	return 0;
}