Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
784 B
5
Indexable
Never
#include <iostream>
#define MAX_N 1000001

using namespace std;

//Tao Node
class Soldier {
public:
    int id, team;
    Soldier* next; 
    Soldier* prev;
   Soldier() {
        id = -1;
        team = -1;
        next = nullptr;
        prev = nullptr;
    }
};

void connect(Soldier* a, Soldier* b)
{
    a->next = b;
    b->prev = a;
}

class List {
public:
    Soldier* head ;
    Soldier* tail ;
    List() {
		head = new Soldier();
		tail = new Soldier();
        connect(head, tail);
    }

    //Ham xoa node
    void erase(Soldier* soldier) {
        connect(soldier->prev, soldier->next);
        delete (soldier);
    }
}

List ll[6][6];
Soldier soldier[MAX_N];

void fire(int mID)
{
    List::erase(soldier+mID);
    
}