示例#1
0
 void del(int x, int c) {
   assert(col[c].count(x));
   int a = prv(x, c);
   int b = nxt(x, c);
   bit.del(x, b);
   if (a != -1) {
     bit.del(a, x);
     bit.add(a, b);
   }
   col[c].erase(x);
 }
示例#2
0
 void add(int x, int c) {
   assert(!col[c].count(x));
   int a = prv(x, c);
   int b = nxt(x, c);
   if (a != -1) {
     bit.del(a, b);
     bit.add(a, x);
   }
   bit.add(x, b);
   col[c].insert(x);
 }