Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
847 B
2
Indexable
Never
struct node{
	int gr,id,sc;
	node* next;
};

node pool[100000];
node* head;
int poolCnt;

node* getN(int a, int b, int c){
	node* newN=&pool[poolCnt++];
	newN->id=a; newN->gr=b; newN->sc=c;
	newN->next=0;
	return newN;
}

void init(){
	poolCnt=0;
	head=0;
}

int len(){
	int dem=0; node* temp=head;
	while(temp!=nullptr){
		dem++; temp=temp->next;
	}
	return dem;
}

void hire(int mID, int mTeam, int mScore){
	node* newN=getN(mID, mTeam, mScore);
	newN->next=head;
	head=newN;
}

void fire(int mID){
	node* temp=head;
	while(temp->next->id != mID){
		temp=temp->next;
	}
	temp->next = temp->next->next;
}

void updateSoldier(int mID, int mScore){
	node* temp=head;
	while(temp->id != mID){
		temp=temp->next;
	}
	temp->sc = mScore;
}

void updateTeam(int mTeam, int mChangeScore){
	for(int i
}
Leave a Comment