const int INF=2e9; struct skip_list { struct node { int num; vector<node*> nxt; vector<node*> prv; vector<int> nxt_len; vector<int> prv_len; node(int x):num(x){} } *begin,*end; int size; skip_list() { size=0; begin=new node(-INF); end =new node(+INF); begin->nxt={ end}; end ->prv={begin}; begin->nxt_len=end->prv_len={1}; } node *find_by_order(int x) { node *cur=begin; int cl=begin->nxt.size(); int cx=-1; while(cl>=0) { while(cl<cur->nxt.size() && cx+cur->nxt_len[cl]<x) { cx+=cur->nxt_len[cl]; cur=cur->nxt[cl]; } cl--; } return cur->nxt[0]; } void insert(node *r,int x) { node *it=new node(x); int cl=0; int c_len=1; do { if(cl==begin->nxt.size()) { begin->nxt.push_back(end); end ->prv.push_back(begin); begin->nxt_len.push_back(size+1); end ->prv_len.push_back(size+1); } while(cl==r->prv.size()) { c_len+=r->nxt_len[cl-1]; r=r->nxt[cl-1]; } it->nxt.push_back(r); it->prv.push_back(r->prv[cl]); it->nxt_len.push_back(c_len); it->prv_len.push_back(r->prv_len[cl]-c_len+1); r->prv[cl]->nxt[cl]=it; r->prv[cl]->nxt_len[cl]=it->prv_len[cl]; r->prv[cl]=it; r->prv_len[cl]=c_len; cl++; } while(rand()&1); while(cl<begin->nxt.size()) { while(cl==r->prv.size()) r=r->nxt[cl-1]; r->prv_len[cl]++; r->prv[cl]->nxt_len[cl]++; cl++; } size++; } void insert(int x) { insert(find_by_order(x),x); } void erase(node *it) { int cl=0; for(;cl<it->nxt.size();cl++) { it->nxt[cl]->prv_len[cl]=it->prv[cl]->nxt_len[cl]=it->prv_len[cl]+it->nxt_len[cl]-1; it->nxt[cl]->prv[cl]=it->prv[cl]; it->prv[cl]->nxt[cl]=it->nxt[cl]; } node *r=it->nxt[cl-1]; for(;cl<begin->nxt.size();cl++) { while(cl==r->prv.size()) r=r->nxt[cl-1]; r->prv[cl]->nxt_len[cl]--; r->prv_len[cl]--; } delete it; size--; } void erase_by_order(int x) { erase(find_by_order(x)); } int &at(int x) { return find_by_order(x)->num; } int &operator [](int x) { return at(x); } } me;
Standard input is empty
prog.cpp:9:9: error: ‘vector’ does not name a type vector<node*> nxt; ^ prog.cpp:10:9: error: ‘vector’ does not name a type vector<node*> prv; ^ prog.cpp:11:9: error: ‘vector’ does not name a type vector<int> nxt_len; ^ prog.cpp:12:9: error: ‘vector’ does not name a type vector<int> prv_len; ^ prog.cpp: In constructor ‘skip_list::skip_list()’: prog.cpp:23:16: error: ‘struct skip_list::node’ has no member named ‘nxt’ begin->nxt={ end}; ^ prog.cpp:24:16: error: ‘struct skip_list::node’ has no member named ‘prv’ end ->prv={begin}; ^ prog.cpp:25:16: error: ‘struct skip_list::node’ has no member named ‘nxt_len’ begin->nxt_len=end->prv_len={1}; ^ prog.cpp:25:29: error: ‘struct skip_list::node’ has no member named ‘prv_len’ begin->nxt_len=end->prv_len={1}; ^ prog.cpp: In member function ‘skip_list::node* skip_list::find_by_order(int)’: prog.cpp:31:23: error: ‘struct skip_list::node’ has no member named ‘nxt’ int cl=begin->nxt.size(); ^ prog.cpp:35:27: error: ‘struct skip_list::node’ has no member named ‘nxt’ while(cl<cur->nxt.size() && cx+cur->nxt_len[cl]<x) ^ prog.cpp:35:49: error: ‘struct skip_list::node’ has no member named ‘nxt_len’ while(cl<cur->nxt.size() && cx+cur->nxt_len[cl]<x) ^ prog.cpp:37:26: error: ‘struct skip_list::node’ has no member named ‘nxt_len’ cx+=cur->nxt_len[cl]; ^ prog.cpp:38:26: error: ‘struct skip_list::node’ has no member named ‘nxt’ cur=cur->nxt[cl]; ^ prog.cpp:42:21: error: ‘struct skip_list::node’ has no member named ‘nxt’ return cur->nxt[0]; ^ prog.cpp: In member function ‘void skip_list::insert(skip_list::node*, int)’: prog.cpp:52:27: error: ‘struct skip_list::node’ has no member named ‘nxt’ if(cl==begin->nxt.size()) ^ prog.cpp:54:24: error: ‘struct skip_list::node’ has no member named ‘nxt’ begin->nxt.push_back(end); ^ prog.cpp:55:24: error: ‘struct skip_list::node’ has no member named ‘prv’ end ->prv.push_back(begin); ^ prog.cpp:56:24: error: ‘struct skip_list::node’ has no member named ‘nxt_len’ begin->nxt_len.push_back(size+1); ^ prog.cpp:57:24: error: ‘struct skip_list::node’ has no member named ‘prv_len’ end ->prv_len.push_back(size+1); ^ prog.cpp:59:26: error: ‘struct skip_list::node’ has no member named ‘prv’ while(cl==r->prv.size()) ^ prog.cpp:61:27: error: ‘struct skip_list::node’ has no member named ‘nxt_len’ c_len+=r->nxt_len[cl-1]; ^ prog.cpp:62:22: error: ‘struct skip_list::node’ has no member named ‘nxt’ r=r->nxt[cl-1]; ^ prog.cpp:64:17: error: ‘struct skip_list::node’ has no member named ‘nxt’ it->nxt.push_back(r); ^ prog.cpp:65:17: error: ‘struct skip_list::node’ has no member named ‘prv’ it->prv.push_back(r->prv[cl]); ^ prog.cpp:65:34: error: ‘struct skip_list::node’ has no member named ‘prv’ it->prv.push_back(r->prv[cl]); ^ prog.cpp:66:17: error: ‘struct skip_list::node’ has no member named ‘nxt_len’ it->nxt_len.push_back(c_len); ^ prog.cpp:67:17: error: ‘struct skip_list::node’ has no member named ‘prv_len’ it->prv_len.push_back(r->prv_len[cl]-c_len+1); ^ prog.cpp:67:38: error: ‘struct skip_list::node’ has no member named ‘prv_len’ it->prv_len.push_back(r->prv_len[cl]-c_len+1); ^ prog.cpp:68:16: error: ‘struct skip_list::node’ has no member named ‘prv’ r->prv[cl]->nxt[cl]=it; ^ prog.cpp:69:16: error: ‘struct skip_list::node’ has no member named ‘prv’ r->prv[cl]->nxt_len[cl]=it->prv_len[cl]; ^ prog.cpp:69:41: error: ‘struct skip_list::node’ has no member named ‘prv_len’ r->prv[cl]->nxt_len[cl]=it->prv_len[cl]; ^ prog.cpp:70:16: error: ‘struct skip_list::node’ has no member named ‘prv’ r->prv[cl]=it; ^ prog.cpp:71:16: error: ‘struct skip_list::node’ has no member named ‘prv_len’ r->prv_len[cl]=c_len; ^ prog.cpp:74:20: error: ‘rand’ was not declared in this scope while(rand()&1); ^ prog.cpp:76:25: error: ‘struct skip_list::node’ has no member named ‘nxt’ while(cl<begin->nxt.size()) ^ prog.cpp:78:26: error: ‘struct skip_list::node’ has no member named ‘prv’ while(cl==r->prv.size()) ^ prog.cpp:79:22: error: ‘struct skip_list::node’ has no member named ‘nxt’ r=r->nxt[cl-1]; ^ prog.cpp:80:16: error: ‘struct skip_list::node’ has no member named ‘prv_len’ r->prv_len[cl]++; ^ prog.cpp:81:16: error: ‘struct skip_list::node’ has no member named ‘prv’ r->prv[cl]->nxt_len[cl]++; ^ prog.cpp: In member function ‘void skip_list::erase(skip_list::node*)’: prog.cpp:95:21: error: ‘struct skip_list::node’ has no member named ‘nxt’ for(;cl<it->nxt.size();cl++) ^ prog.cpp:97:17: error: ‘struct skip_list::node’ has no member named ‘nxt’ it->nxt[cl]->prv_len[cl]=it->prv[cl]->nxt_len[cl]=it->prv_len[cl]+it->nxt_len[cl]-1; ^ prog.cpp:97:42: error: ‘struct skip_list::node’ has no member named ‘prv’ it->nxt[cl]->prv_len[cl]=it->prv[cl]->nxt_len[cl]=it->prv_len[cl]+it->nxt_len[cl]-1; ^ prog.cpp:97:67: error: ‘struct skip_list::node’ has no member named ‘prv_len’ it->nxt[cl]->prv_len[cl]=it->prv[cl]->nxt_len[cl]=it->prv_len[cl]+it->nxt_len[cl]-1; ^ prog.cpp:97:83: error: ‘struct skip_list::node’ has no member named ‘nxt_len’ it->nxt[cl]->prv_len[cl]=it->prv[cl]->nxt_len[cl]=it->prv_len[cl]+it->nxt_len[cl]-1; ^ prog.cpp:98:17: error: ‘struct skip_list::node’ has no member named ‘nxt’ it->nxt[cl]->prv[cl]=it->prv[cl]; ^ prog.cpp:98:38: error: ‘struct skip_list::node’ has no member named ‘prv’ it->nxt[cl]->prv[cl]=it->prv[cl]; ^ prog.cpp:99:17: error: ‘struct skip_list::node’ has no member named ‘prv’ it->prv[cl]->nxt[cl]=it->nxt[cl]; ^ prog.cpp:99:38: error: ‘struct skip_list::node’ has no member named ‘nxt’ it->prv[cl]->nxt[cl]=it->nxt[cl]; ^ prog.cpp:101:21: error: ‘struct skip_list::node’ has no member named ‘nxt’ node *r=it->nxt[cl-1]; ^ prog.cpp:102:24: error: ‘struct skip_list::node’ has no member named ‘nxt’ for(;cl<begin->nxt.size();cl++) ^ prog.cpp:104:26: error: ‘struct skip_list::node’ has no member named ‘prv’ while(cl==r->prv.size()) ^ prog.cpp:105:22: error: ‘struct skip_list::node’ has no member named ‘nxt’ r=r->nxt[cl-1]; ^ prog.cpp:106:16: error: ‘struct skip_list::node’ has no member named ‘prv’ r->prv[cl]->nxt_len[cl]--; ^ prog.cpp:107:16: error: ‘struct skip_list::node’ has no member named ‘prv_len’ r->prv_len[cl]--; ^
Standard output is empty