int main(){
	int i,a,b,t;
	char s[5];
	for(i=0;i<30000;i++)h1[i]=i+1;
	while(scanf("%d %s",&a,s)!=EOF){
		while(l2>0&&m[h2[0]]<a){
			t=get2();
			m[t]=0;
			add1(t);
		}
		if(s[0]=='+'){
			t=get1();
			printf("%d\n",t);
			m[t]=a+599;
			add2(t);
		}else{
			scanf("%d",&b);
			if(m[b]==0)printf("-\n");
			else{
				printf("+\n");
				m[b]=a+599;
				adj2(b);
			}
		}
	}
	return 0;
}
Exemplo n.º 2
0
bool circuit::goodCircuit()
{
    matrix<int> adj2 = circuit_graph.adjacency_matrix();
    adj2 = adj2*adj2;
    for(int i=0;i<circuit_graph.nVertices();i++) if(adj2(i,i)<2) return false;
    return circuit_graph.isConnected();
}
int get2(){
	int r=h2[0];
	l2--;
	if(l2==0)return r;
	h2[0]=h2[l2];
	p2[h2[0]]=0;
	adj2(h2[0]);
	return r;
}