-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathslist_test.cpp
More file actions
54 lines (42 loc) · 1.16 KB
/
Copy pathslist_test.cpp
File metadata and controls
54 lines (42 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "slist.hpp"
#include <iostream>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
signed main() {
rmRecorder<ll> re;
slist<ll> te;
te.regRec(&re);
node<ll> *p1 = te.begin(), *p2 = te.begin(), *p3 = te.begin(),
*p4 = te.begin();
for (ll i = 0; i < 10; i++) {
te.add(i);
if (i == 0) p1 = te.end()->prev();
if (i == 7) p2 = te.end()->prev();
if (i == 3) p3 = te.end()->prev();
if (i == 9) p4 = te.end()->prev();
}
for (node<ll> *it = te.begin(); it != te.end(); it = it->next())
cout << *(it->X) << " ";
cout << endl;
re.nextLayer();
te.rm(p1);
te.rm(p2);
for (node<ll> *it = te.begin(); it != te.end(); it = it->next())
cout << *(it->X) << " ";
cout << endl;
re.nextLayer();
te.rm(p3);
te.rm(p4);
for (node<ll> *it = te.begin(); it != te.end(); it = it->next())
cout << *(it->X) << " ";
cout << endl;
re.backtrack();
for (node<ll> *it = te.begin(); it != te.end(); it = it->next())
cout << *(it->X) << " ";
cout << endl;
re.backtrack();
for (node<ll> *it = te.begin(); it != te.end(); it = it->next())
cout << *(it->X) << " ";
cout << endl;
}