-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq.cpp
More file actions
41 lines (33 loc) · 680 Bytes
/
Copy pathq.cpp
File metadata and controls
41 lines (33 loc) · 680 Bytes
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
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#define alc(c, x) int *c = (int *)malloc(x * sizeof(int))
#define fr(i, a, v) for (int i = a; i < v; i++)
typedef struct Ponto
{
int e;
char c;
int d;
} ponto;
int main()
{
int x, e, d, pr;
ponto zero;
char c;
scanf("%d", &x);
ponto *ls = (ponto *)malloc(200000 * sizeof(ponto));
fr(i, 0, x)
{
scanf("%d %c %d", &e, &c, &d);
ls[e].e = e;
ls[e].c = c;
ls[e].d = d;
}
pr = ls[0].d;
printf("%c", ls[0].c);
fr(i, 0, x) {
printf("%c", ls[pr].c);
pr = ls[pr].d;
}
printf("\n");
}