-
Notifications
You must be signed in to change notification settings - Fork 0
/
test2d.c
233 lines (212 loc) · 4.11 KB
/
test2d.c
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/* tests for two-dimensional trajectories */
#include <stdio.h>
#include <stdlib.h>
static void test00(void)
{
printf("1\n");
printf("5\n");
printf("1 1 1\n");
printf("2 2 -1\n");
printf("3 4 -1\n");
printf("4 4 2\n");
printf("5 5 0\n");
printf("3\n");
printf("0 -2 3 2 1 5");
printf("0 -2 6 3 10 15");
printf("5 -1 7 1 20 30");
}
static void test01(void) /* start and end will be the same */
{
printf("1\n");
printf("5\n");
printf("1 3 2\n");
printf("2 5 2\n");
printf("3 0 -3\n");
printf("4 4 -1\n");
printf("5 3 2\n");
printf("3\n");
printf("2 1 6 3 0 4");
printf("2 0 3 1 0 10");
printf("6 0 7 1 0 5");
}
static void test02(void)
{
printf("1\n");
printf("8\n");
printf("1 -1 2\n");
printf("2 1 -2\n");
printf("3 -1 2\n");
printf("4 5 2\n");
printf("5 6 4\n");
printf("6 4 4\n");
printf("7 6 -2\n");
printf("8 7 -2\n");
printf("4\n");
printf("-2 0 0 3 0 10");
printf("1 1 7 5 0 10");
printf("1 -3 6 0 0 5");
}
static void test03(void) /* all path on the edges */
{
printf("1\n");
printf("4\n");
printf("1 2 2\n");
printf("2 4 2\n");
printf("3 4 -2\n");
printf("4 -2 -2\n");
printf("1\n");
printf("2 -2 4 2 0 10");
}
static void test04(void) /* never enter the query but will arrive at the vertices and turn back and won't cut the edges */
{
printf("1\n");
printf("9\n");
printf("1 0 1\n");
printf("2 1 1\n");
printf("3 1 0\n");
printf("4 3 1\n");
printf("5 4 2\n");
printf("6 3 3\n");
printf("7 2 4\n");
printf("8 1 3\n");
printf("9 0 3\n");
printf("1\n");
printf("1 1 3 2 0 10");
}
static void test05(void) /* enter from one edge and exit from another edge */
{
printf("1\n");
printf("6\n");
printf("1 0 2\n");
printf("2 1 2\n");
printf("3 0 1\n");
printf("4 2 0\n");
printf("5 2 2\n");
printf("6 4 2\n");
printf("1\n");
printf("1 1 3 3 0 10");
}
static void test06(void) /* enter from one vertex and exit from another vertex */
{
printf("1\n");
printf("10\n");
printf("1 0 4\n");
printf("2 3 3\n");
printf("3 2 2\n");
printf("4 1 3\n");
printf("5 0 0\n");
printf("6 4 0\n");
printf("8 3 1\n");
printf("9 2 2\n");
printf("10 3 3\n");
printf("11 3 10\n");
printf("1\n");
printf("1 1 3 3 0 10");
}
static void test07(void) /* the path will finish in the query */
{
printf("1\n");
printf("4\n");
printf("1 0 0\n");
printf("2 1 1\n");
printf("3 2 1\n");
printf("4 2 2\n");
printf("1\n");
printf("1 1 3 3 0 10");
}
static void test08(void)
{
printf("1\n");
printf("2\n");
printf("1 0 0\n");
printf("2 10 10\n");
printf("4\n");
printf("0 10 1 11 0 100\n");
printf("2 2 4 4 0 100\n");
printf("3 2 7 10 0 100\n");
printf("1 3 10 4 0 100\n");
}
static void test09(void)
{
printf("1\n");
printf("5\n");
printf("1 0 0\n");
printf("2 10 10\n");
printf("3 20 0\n");
printf("4 30 10\n");
printf("5 40 0\n");
printf("1\n");
printf("0 5 50 15 0 100\n");
}
static void test10(void)
{
printf("3\n");
printf("3\n");
printf("10 10 0\n");
printf("20 20 0\n");
printf("30 30 0\n");
printf("3\n");
printf("10 10 10\n");
printf("20 20 10\n");
printf("30 30 10\n");
printf("3\n");
printf("10 10 20\n");
printf("20 20 20\n");
printf("30 30 20\n");
printf("4\n");
printf("14 5 24 15 5 100\n");
printf("14 5 24 25 5 100\n");
printf("14 -5 24 15 5 100\n");
printf("14 -5 24 25 5 100\n");
}
static void test11(void)
{
printf("1\n");
printf("9\n");
printf("10 10 0\n");
printf("20 20 0\n");
printf("30 30 0\n");
printf("30 10 10\n");
printf("40 20 10\n");
printf("50 30 10\n");
printf("50 10 20\n");
printf("60 20 20\n");
printf("70 30 20\n");
printf("4\n");
printf("14 5 24 15 5 100\n");
printf("14 5 24 25 5 100\n");
printf("14 -5 24 15 5 100\n");
printf("14 -5 24 25 5 100\n");
}
int main(int argc, char *argv[])
{
int num;
if (argc != 2)
return 1;
num = atoi(argv[1]);
if (num == 0)
test00();
else if (num == 1)
test01();
else if (num == 2)
test02();
else if (num == 3)
test03();
else if (num == 4)
test04();
else if (num == 5)
test05();
else if (num == 6)
test06();
else if (num == 7)
test07();
else if (num == 8)
test08();
else if (num == 9)
test09();
else if (num == 10)
test10();
else if (num == 11)
test11();
return 0;
}