fork(2) download
  1. #include <cstdio>
  2. #include <cctype>
  3. #include <cstring>
  4. #include <vector>
  5. #include <queue>
  6. #include <algorithm>
  7.  
  8. #define MAXN 28
  9. using namespace std;
  10.  
  11. int main(){
  12. #ifndef ONLINE_JUDGE
  13. freopen("C:\\acm_inp\\projsched.in", "r", stdin);
  14. freopen("C:\\acm_inp\\projsched.out", "w", stdout);
  15. #endif
  16. int tc, time, u, v, i, j, maxFinTime, inDegrees[MAXN], minFinTime[MAXN], projTimes[MAXN];
  17. char inpLine[100], pn, others[100], printLine=0;
  18. bool graph[MAXN][MAXN];
  19. //vector<int> graph[MAXN];
  20.  
  21. scanf("%d", &tc);
  22. fgets(inpLine, 100, stdin);
  23. fgets(inpLine, 100, stdin);
  24. while( tc-- ){
  25. memset(inDegrees, -1, sizeof(inDegrees));
  26. memset(graph, 0, sizeof(graph));
  27.  
  28. while( fgets(inpLine, 100, stdin) && inpLine[0]!='\n' ){
  29. for(i=0; inpLine[i]==' '; i++);
  30. if(!inpLine[i] || inpLine[i]=='\n')
  31. break;
  32. sscanf(inpLine+i, "%c", &pn);
  33. for(i++; inpLine[i]==' '; i++);
  34. sscanf(inpLine+i, "%d", &time);
  35. j = time;
  36. while(j)
  37. j/=10, i++;
  38. for(i++; inpLine[i]==' '; i++);
  39.  
  40. u = pn-'A';
  41. inDegrees[u] = 0;
  42. projTimes[u] = time;
  43. for(; inpLine[i]; i++){
  44. if(inpLine[i]>='A' && inpLine[i]<='Z'){
  45. v = inpLine[i]-'A';
  46. //graph[v].push_back(u);
  47. graph[v][u] = 1;
  48. inDegrees[u] ++;
  49. }
  50. }
  51. }
  52.  
  53. queue<int> q;
  54. vector<int> topoSort;
  55. for(i=0; i<MAXN; i++){
  56. if(inDegrees[i]==0)
  57. q.push(i);
  58. }
  59.  
  60. while( !q.empty() ){
  61. u = q.front();
  62. q.pop();
  63. topoSort.push_back(u);
  64. //for(i=0; i<graph[u].size(); i++){
  65. //v = graph[u][i];
  66. for(v=0; v<MAXN; v++){
  67. if(graph[u][v]){
  68. inDegrees[v] --;
  69. if(inDegrees[v]==0)
  70. q.push(v);
  71. }
  72. }
  73. }
  74.  
  75. memset(minFinTime, 0, sizeof(minFinTime));
  76. maxFinTime = 0;
  77. for(i=0; i<topoSort.size(); i++){
  78. u = topoSort[i];
  79. //for(j=0; j<graph[u].size(); j++){
  80. //v = graph[u][j];
  81. for(v=0; v<MAXN; v++){
  82. if(graph[u][v]){
  83. minFinTime[v] = max(minFinTime[v], minFinTime[u]+projTimes[v]);
  84. maxFinTime = max(maxFinTime, minFinTime[v]);
  85. }
  86. }
  87. }
  88.  
  89. if(printLine)
  90. printf("\n");
  91. else
  92. printLine = 1;
  93. printf("%d\n", maxFinTime+projTimes[0]);
  94. }
  95.  
  96. return 0;
  97. }
  98.  
  99.  
Success #stdin #stdout 0s 2824KB
stdin
100

A 52
B 98 A
C 68 A
D 97
E 9 C
F 37 C D E
G 69 D E F
H 42 E
I 5 C E G H
J 60 B F G I
K 76 C E F G H J
L 55 A B F H K
M 33 B C D E H J
N 96 A B C D E F I M
O 33 A B C H I N
P 98 B C G H J L N
Q 11 B E F H K L O P
R 91 A B C D F H I J K M N Q
S 13 C D E K L M
T 57 C D E F L P Q S
U 13 A B C F G H I J L M N P Q S T
V 5 A C F G H J P Q R S T
W 2 B C D F G H K O Q R S T U V
X 93 C D E G J K M O P Q R T
Y 94 A B C E H J M P Q R S U W
Z 92 B E H I L N O P Q R T U Y

A 76
B 30
C 70
D 34 B C
E 52 A C D
F 82 C D E
G 9 A F
H 99 A C D F G
I 53 A B D E F G
J 2 D H
K 37 A E G H J
L 14 A D E F H J K
M 6 A D E F G I J L
N 85 B J
O 79 B G I K L M N
P 9 A C K L N O
Q 83 A C D E H I J L N P
R 9 B C E I J M O P Q
S 14 B C D E J M O R
T 6 B C E F G H K L M Q
U 67 E H I J L N O P Q S T
V 39 I J K L M N Q R S U

A 2
B 37
C 16
D 43 A B C
E 20 A B
F 29 A B C
G 36 A D E F

A 35
B 20
C 72
D 70 B C
E 2 B C D
F 90 A B C
G 77 E F
H 98 B C E F
I 47 A B E
J 7 D H I
K 76 A D F H J
L 13 A D E F G H K
M 8 A D F I
N 83 A B D F H J L

A 79
B 57
C 87
D 48 A C
E 8 D
F 67 A D
G 90 A C D F
H 54 D F G
I 90 A B D E F G H
J 84 B G H I
K 50 B D E G H I
L 94 A C E G J K
M 63 A B C F G H I K
N 91 A B F K L M
O 77 A E G H L
P 42 H M N O
Q 76 B C E F G I K L N O
R 71 A F I J K Q
S 78 A D E M N O P Q R
T 47 D E F G H I J
U 24 G H I J L M N T
V 93 B D E G H J K L O Q S U
W 69 A C F H I K L M O R T
X 7 A C E F G I J L M N O R S T U
Y 49 C D F G I L M N O R S T U W X
Z 30 A B C D E G H L M O P S T U V W X Y

A 80
B 73 A
C 77 A
D 96 B
E 31 B C D
F 93 C D
G 77 A B D F
H 86 A B D E F
I 33 B C F G H
J 8 A B C E F
K 2 A D F G H J
L 71 B D E I J K
M 3 D G J L
N 67 B H J L
O 86 B D E G K
P 17 A C F J K L M O
Q 98 E G H J M N O P
R 31 B C H I J K L M N O P Q
S 59 A B C E G H K L M N Q
T 42 A C D E J K L P Q R
U 88 A C E F H J M N O R
V 52 A B C D H O P S T
W 9 F J K L N O R S U V
X 50 C E G H I J K L M N P Q R W
Y 54 C D E G H K M O Q S U V W

A 48
B 88 A
C 14 A B
D 92 A B C
E 86 A B C
F 93 A D E
G 22 A B D E F
H 15 A C E F G
I 41 A B D E F H
J 3 A C E
K 74 B D J
L 2 A C D E H I K
M 89 A B C E F I J
N 97 E G I K L M
O 41 A B F G J N
P 18 A B C D E F G H I J L N
Q 49 B C D I J K L P
R 47 A E F G I J K L M O P
S 60 A C D E H J K L P R
T 34 D E F H J K L Q
U 42 A B C F H K N O P R T
V 65 C F G K L M O P S
W 17 B D F H K N O P Q R S T U V
X 45 C D E G N P V W

A 59
B 79 A
C 8
D 5
E 29 A D
F 13 A B C D
G 83 A C D F
H 61 D E G

A 85
B 89 A
C 35 A
D 18 A B C
E 40 D
F 27 A B
G 91 A C D E F
H 67 D

A 58
B 88
C 93
D 37 B
E 55 A D
F 19 A B D
G 93 D E

A 64
B 40 A
C 52
D 32 A B C
E 44 A C D
F 22 D
G 17 A C D
H 51 B C F G
I 98 A C G
J 81 A C D H
K 70 A G
L 89 A B C G H
M 8 I K L
N 86 A D H I J K L
O 16 A C F I M
P 17 E F H L M O
Q 60 A B C D I K L N
R 98 B C E H J K N P
S 59 A C E G H K O P R
T 3 D E G O R S

A 21
B 35
C 92
D 9 A

A 30
B 75 A
C 69 B
D 10 A C
E 23 B D
F 71 B D
G 95 A C F
H 98 C D E

A 13
B 79
C 44
D 49
E 96 A C D

A 3
B 44 A
C 21
D 71
E 30 A B D
F 20 A D
G 65 C E F
H 86 A C D E G
I 41 A B C E G H
J 6 A D I
K 87 E G J
L 5 A B C D E G J K
M 24 A G H I J K L
N 75 A B C D F G H M
O 16 B C D F G I K M N
P 61 C D E I J L N O
Q 24 A F H I L M N O P
R 1 B C E F J L N Q

A 47
B 14 A
C 22 A B
D 6 A
E 0 A B
F 72 B
G 2 C E F
H 35 D E
I 16 B E H
J 74
K 99 A C F H I
L 48 A C E F H K
M 74 C F G J K
N 47 C D F G H J L M
O 35 B G I J K L M
P 76 E G I O
Q 71 C H I J N
R 95 B G J N P
S 35 A C E G H K L M P
T 97 C D H J K L P Q

A 75
B 78
C 76 A
D 48 B
E 87 A
F 76 C D E
G 68 D E
H 7 A B D E
I 96 C E H
J 64 C D E H
K 22 B F H I J
L 37 A B C K
M 64 A C H I K L
N 68 A B F G I J L M
O 96 A B C D E H J K L N
P 81 A G H I J M O

A 89
B 66 A
C 55 A B
D 57 B
E 56 A C
F 1 A D
G 65 A B D E F
H 43 C E
I 50 A F
J 79 B C E F G
K 57 A B D E H
L 1 B E G
M 62 A C E F J L
N 2 B E F G H I J M
O 34 B E G H I L M N
P 25 G H I K L M N
Q 9 A B G L M N O P
R 75 A B C D E F G H L P
S 88 I J K M Q R
T 9 C E H I K L N O R
U 2 B C D F G H L O P T
V 64 A B D G J L N P R S U
W 32 A B G H M N Q S T U V
X 53 A C I J L M P R S
Y 57 A D H J M O Q R T
Z 29 A B E F G I L N Q S T U W X

A 91
B 30
C 27 B
D 64 B
E 33 A D
F 94 C
G 83 B E F
H 17 A B E F
I 51 E F H
J 61 B C D E F
K 19 D E G H I
L 87 C D J
M 83 C D F H I
N 75 B C D E J M
O 9 B C E F G H K L M N
P 33 A C E F G I J O
Q 25 A D H L M N O
R 57 C D E F H I K L
S 47 C D F G K N P Q
T 86 A B C I M N Q R
U 35 G H I J K Q
V 11 D G L M O P Q R
W 74 B C F J N O P Q R T V
X 95 C D F G K N O Q S W
Y 78 A E F G H I L N O R V W X

A 16
B 31
C 38
D 19 A C

A 65

A 99
B 94 A
C 61 A B
D 56 B
E 41 A B C D
F 18 A
G 72 A C
H 8 A C D E
I 78 B C D F
J 90 B E F I
K 21 C E F G H I J
L 53 A D E F H I K
M 92 B C D E G J K L
N 76 C D F G I K
O 94 A C D G I J K L M
P 22 D G H I J L N O
Q 22 B C E F G H L M O
R 7 A B C D H J K L N P
S 72 A B C E F G J K O P R
T 69 E F I L M N P R
U 82 C J K N P Q R
V 39 F J
W 13 B C D G H I K L N O Q R S T U
X 44 A E J K O P Q R T U V
Y 6 A B C F H J K L M N O Q T V

A 46
B 73
C 33 A
D 38 C
E 8 A B C D
F 6 A E
G 96 A F
H 96 D E
I 33 C D F G
J 88 A B C D E G H
K 79 A B C E F H
L 77 B D H J K
M 19 C G H I L
N 33 H
O 39 A B E F G I J K M N
P 37 C E F G H K N

A 72
B 38
C 85 A B
D 24 A
E 58 A B C
F 37 B D
G 49 C D
H 54 A C D
I 38 F G
J 69 A D E F H I
K 63 C E F G J
L 20 F I J K
M 29 D F H I K L

A 2
B 71 A

A 12
B 38
C 42 B

A 99
B 53 A
C 22
D 51 C
E 15 D
F 99 C E
G 68 A B D F
H 6 A C E

A 79
B 15 A
C 73 B
D 73 C

A 57
B 22 A
C 84
D 45 C
E 1 C D
F 34 B C D E
G 60 D E F
H 44 C E F
I 29 B C F
J 49 A F I
K 90 B C E F G
L 52 C D G H
M 72 F G I L
N 12 A J K
O 8 E G H M N
P 62 B E H K L M N
Q 77 A C E F G I J K
R 35 F I N Q
S 28 C G J N Q
T 54 C F I K L N P Q
U 9 F H K M P Q S T
V 23 C E G H I J L M O Q T U

A 90
B 77 A

A 45
B 92 A
C 64 A
D 58 C
E 95 A B
F 31 A B C E
G 38 A E
H 46 C F G
I 12 A D E F H
J 30 A C F G H I
K 95 C G H
L 38 B F G J K
M 44 A C E G J K
N 41 A B D E F G H I J K L M
O 70 A C E F G H J N
P 60 B C E F G N O
Q 96 B C E F G I J K M P
R 5 A B C E F G H I J K N O P Q
S 69 C D E H I K N P Q R
T 90 D G H I J L M
U 25 A B C D E G I M O P Q R
V 20 A B C D E G H J L Q S U
W 89 A B C H J L M O Q S U V

A 46

A 89
B 72 A
C 99 A
D 40 A B
E 69 A B D
F 30 A B C D
G 22 C F
H 8 E F
I 82 B C F G H
J 44 C D E G H
K 59 H
L 49 D I J
M 37 B E G J
N 42 B C E H K
O 21 B C D F K N
P 72 B D F I J L M
Q 48 B E F I K L O
R 61 A C F I J K M N P Q
S 44 E K L N O P Q R
T 61 A B D I J K L Q
U 62 A B C E G K L R T
V 14 B E F G H I J M O P Q S U
W 19 B C G H I J L M N Q T V
X 34 C F G H I J M N O S T U
Y 59 A C D G I L P Q S U X
Z 48 A B C E F G H K L M R U V W X Y

A 21
B 59
C 22 B
D 59 A B

A 77

A 25
B 95 A
C 0 A B
D 26 A B C
E 65 D
F 97 A B D E
G 93 A F
H 67 A E G
I 40 D E G
J 67 B D F H

A 90
B 48 A
C 9 A
D 53 A B C
E 89 B C
F 90 A C D E
G 49 D E
H 38 A B D F
I 32 D E
J 94 B D F G H I
K 31 B F G I

A 6
B 7
C 62 B
D 30 A
E 81 A C
F 85 B C D E
G 36 A B
H 94 A B E
I 27 B C E
J 34 A C E H
K 15 A C D E G H J
L 44 A B C E H J K
M 42 B D F G H J
N 55 A B D E
O 97 A B D G H L M N
P 95 A E F G H I K L
Q 89 A B E L M
R 36 A B C F J M O P
S 6 D G H J K O P Q
T 38 A C E F H I J K L M N O Q R
U 8 A B C E G H I J K P T
V 83 A C E F G I J L Q R S T U
W 29 A B E J L M N S U V

A 37
B 66 A
C 65 A
D 78 A B C
E 45 A B C D
F 21 A E
G 79 A B C D F
H 88 B C E G
I 29 C E G H
J 46 E I
K 35 A C D I J
L 61 A B E F K
M 43 A B D E H I
N 84 E G H J L M
O 61 D E F G I J N
P 96 B I J M N
Q 86 A E G H I K L O
R 66 A B E G K L O
S 3 A C E F G K N O Q
T 40 F M N O P S
U 37 B D E F H J K L M N O P S T
V 72 B D F G K L M R S T
W 18 A B C F H M O S T U
X 41 D E F H J K L M O R
Y 8 A C E F H K L M N O S X

A 51
B 45 A
C 9 A B
D 88 A B C
E 57 B
F 75 A E
G 10 A B C D E F
H 23 E G
I 59 B D
J 77 A C H I
K 94 C E H I
L 16 B C F G H
M 88 A D E H
N 97 B E F J K
O 62 E F L M
P 57 A H L M O
Q 41 B F I J N O P
R 99 A C D F I J L M N O Q
S 31 A C D E H J K P
T 74 C D I J K P Q S
U 25 A D G J M
V 75 A C D F G H L N O R S T
W 81 C I K L M N U
X 5 A B C H I K L M N P T U W

A 14
B 10
C 29 A B
D 34
E 79 C D
F 17 C D E
G 23 C D E
H 19 A C D E
I 40 A B D G H
J 75 A B F G H I
K 32 B D F H J
L 91 E J K
M 89 A B D F I J K
N 53 E H L
O 41 A B E J L
P 80 B D N
Q 17 B D G J K L M N O
R 54 A B D E G H I J M N O P Q
S 42 A B C G H K O P
T 85 A D F H J K M O P
U 92 C F G H I J K L M N P S
V 8 C G J P Q S U
W 24 D E H L M O R S U V
X 66 C E F G H I J K L O U W
Y 13 B F I J L N Q S T W

A 37
B 60 A
C 31
D 13 A C
E 1 A B D
F 10 C
G 35 A
H 16 A B C D F G
I 77 C F G
J 64 D H I
K 76 B F G
L 85 A B E G J
M 2 A B C E G H

A 87
B 24 A
C 77
D 44 A C
E 6 C
F 48 A B C D
G 25 E F
H 22 A C D E F
I 47 A B G H
J 13 A E
K 68 B C E F G
L 22 H I J
M 67 A B C D E F H I J K L
N 84 C D E F G H I J K L M
O 83 B C G I L M N
P 46 E F G L N O
Q 11 F G J L O
R 80 C D F I J L N O
S 21 A B D E F H I L O P R
T 76 D F L M N O P S

A 79
B 83
C 70 A
D 99 C
E 26 B
F 59 A C D

A 58
B 82
C 47 A B
D 51
E 85 D
F 52 B C
G 38 A C F
H 28 E G
I 90 A B F
J 50 C D E F G I
K 19 B G I J
L 18 A C G H J K
M 3 B G H J K L
N 17 C D E F G H I J L
O 11 A B E F H K L M
P 61 B C G I K
Q 59 A B E F I J K L N
R 60 A C D E F G H J N O P Q
S 55 B D F H I K L O P
T 60 A B E H L N O P
U 19 A C F G I J M N O Q R S T
V 53 B D F G H I J L N P S
W 53 A B D E G I J K L O Q S T V
X 42 C E F H K L M N P Q R S V W
Y 12 C D J O S T W X
Z 57 B C D E F G H K N O P Q R S T V Y

A 12
B 79
C 39
D 33 B
E 7 B D
F 20 B C D E
G 36 C F
H 61 A B C E F
I 4 C G
J 65 A F
K 69 A C E G H I
L 29 A D G H
M 36 F K
N 81 A B F I J K L
O 22 A C F J M
P 99 A B D E G H J L O

A 55
B 27
C 3 B
D 90 B C
E 27 A B C
F 96 A C E
G 98 A B E
H 48 B C E F
I 69 A E G H
J 44 C D I
K 84 E G H I
L 31 B C D F G H J K
M 70 B E H K
N 61 A D F G I M
O 91 B C E I J M
P 71 C I K N O
Q 20 A C D F G O
R 54 C F H K L M N
S 73 B E F H I K L M N O R
T 89 C G H J L M N O P Q S
U 18 A C E F G H I J L M N O P Q S T
V 74 A C E F G K M O Q S
W 48 B C D H J K L N P Q R S U V
X 38 A B D E H J K N P Q S W
Y 35 A C D E I P Q R S T V W X
Z 57 B C F G O S X Y

A 57
B 48
C 56
D 3 A
E 28 A
F 52 C E
G 23
H 49 A B D G
I 2 A B C D E
J 34 C D G

A 20
B 42 A

A 87
B 2 A
C 32 B
D 84 A B C
E 8
F 36 A B C
G 1 B
H 2 A C E F
I 49 A B E G
J 35 A B E H
K 72 A D J
L 32 A B D E F G I
M 78 C D G I J K
N 51 A C D H J L M
O 93 A B C D F G H J M N
P 59 A B C I J M O
Q 76 A B C E F G I J L N O P
R 92 B C E F G M O
S 83 A B C D G H J L M O Q
T 10 B E H I K O P R S
U 48 A D E F M O R T
V 67 A B C E F M N O Q R T U
W 30 A B C D E G J L M N P Q T V
X 38 B C D E F G H K L N O Q T U V W
Y 54 A F G L M N O P Q S T U X
Z 46 C E F G H J L P R T W Y

A 22

A 38
B 71 A
C 95 A
D 89 B

A 1
B 29
C 99
D 53 A B
E 11 B C D
F 65 C D
G 10 B C
H 52 C
I 16 A B C G

A 8
B 46 A
C 48
D 10 B
E 49 C
F 78 D
G 60 B
H 17 B E
I 15 B H
J 17 B C G H I
K 15 A B C D E G I J
L 4 B C D F G K
M 8 B F G H I J
N 70 A B F G H K M
O 90 C G I K M
P 79 A B E I K L M N O
Q 61 A B E F G H J M N O
R 56 A B C E G H I J K O P Q
S 87 D G I L N Q
T 74 A B C F H J M S
U 32 A D G I J M N P T
V 71 B E J K M P R S T U
W 65 B E J K M N O Q R S U
X 39 A C E I J L N O P Q T V

A 94
B 19 A
C 35 B
D 26 B C
E 54 B D
F 48 A B C
G 67 A B C D E F
H 9 A B C D G
I 62 B C D G
J 69 A D F H
K 45 B C D E G I J

A 63
B 26 A

A 35

A 30
B 76 A
C 51 B
D 26 A B C
E 19 B D
F 69 A E
G 32 A B C E
H 8 B C D E G
I 68 D E G H
J 79 B E F
K 11 B F G H
L 0 A D F G H J K

A 71
B 43
C 94 A
D 5

A 89
B 60
C 18 A
D 42 A B C
E 23 B
F 20 A B C
G 68 A C D E F
H 22 C F
I 16 B D E H
J 10 C D E F G
K 50 A B C D E F I
L 82 C E H J K
M 90 C E F H I J
N 63 B C D E F G H J L
O 69 A B D E G H I K M N
P 62 D E I J L M N O
Q 16 E G H I J L M N O P
R 17 G H I M O P
S 37 A E F K L M N O Q R
T 30 A C D G I M P Q R
U 53 C D E G H L M N P Q R
V 60 C D F I L M N P S T
W 28 B C D E G H M O P S U

A 47
B 52
C 15 A B
D 17 B C
E 7 A C

A 28
B 42 A
C 58 A
D 9 A C
E 98 A C D
F 33 A B C E
G 66 C D E F
H 3 B C F
I 66 B C D E G
J 49 B D F
K 7 B C D E J
L 50 A B C H I J K
M 48 A B D E F G I K
N 26 A E G I J L M
O 93 D E F G K L M
P 36 A D I K O
Q 49 A B F G H L M O P
R 48 A D E H I M N O Q
S 93 A B E J K L M N O
T 30 A D G H I J K Q R S

A 53
B 8
C 62 A B
D 97 A
E 82 A
F 4 B C D E
G 90 A B D F
H 54 A C D E F
I 80 A D F G
J 94 A C E G
K 41 A C E F G J
L 36 A D E G J K

A 60
B 15 A
C 67 B
D 85 B C
E 63 A

A 11
B 17
C 8 A B
D 75 B
E 76 B C

A 87
B 4 A
C 17 A
D 37 B
E 97 A B D
F 62 A B D
G 49 A F
H 31 B
I 86 A C G
J 67 A B C D F I
K 82 B D F
L 84 B C E F I K
M 86 A C E F H I J K
N 63 A D G I J K
O 0 A C E G H I K M N
P 20 A C H I L N O
Q 52 B C F G H J K L O
R 46 C G H K L M N
S 84 F G H J M
T 20 B C H L M O P
U 50 B F H I J K L P Q T
V 78 C E G J L M N Q R
W 75 A B C F H J L M N Q S V

A 46
B 77
C 51 A B
D 39 A
E 16
F 20 B D E
G 63 A B C E F
H 40 D F G
I 39 C D F G
J 48 A C D G H
K 8 A B C D E F G I
L 13 A B C H K
M 69 A C E H J L
N 88 A B D E I L
O 64 C D F I N
P 51 B D E F H I J K M
Q 25 B D E G H I K L
R 19 A B H I L P
S 81 C D E F H I K M O Q R
T 18 A C D E G H J K M O P Q S
U 20 A D E G H I K M O Q R S T
V 40 B C N O P R T

A 30
B 7
C 36 B
D 27 A B C
E 33 A C D
F 84 B E
G 71 A B
H 63 B C D F G
I 31 B C D G H
J 73 A B C E G H I
K 33 A B C F G H I
L 57 D E G H I J

A 24
B 80
C 70 A B
D 0 C
E 94 B C D
F 69 B E
G 40 B D F
H 44 D E F
I 80 A B C E F
J 87 A D G I

A 50
B 49
C 94 A B
D 15
E 55 B D
F 53 A B C D
G 18 A C D
H 66 A B
I 43 A C D E F H
J 71 D E
K 27 B F H I
L 73 C D E F G
M 79 B E F H I J K L
N 88 B C E H I K M
O 63 A B C E H J K L N
P 96 A B I J K L

A 27
B 31
C 17 B
D 23 A B C
E 78 B C
F 27 C E
G 43 C E F
H 76 A B C E

A 47
B 11 A
C 20 A B
D 64 A B C
E 21 D
F 26 B C
G 70 B C D E F
H 97 A B C E F G
I 60 A G
J 75 A E H I
K 54 A C E G H I J
L 82 C E F I J K
M 15 A B D E H I L
N 81 A B I K
O 59 A B D F G H I J K N
P 85 D G H I J L M N
Q 38 B C D G H I K M O P

A 75
B 46 A
C 39 A
D 90 B
E 49
F 93 A C D E

A 23
B 91
C 17
D 96 A B C
E 79 A D
F 5 A C

A 16
B 1
C 69 A
D 47 B
E 23 A B D
F 87 A B D
G 76 A B C
H 47 B C D F
I 54 C G
J 13 B
K 56 D G
L 82 C D F G H I K
M 78 A B C D E F G H I J L
N 40 I J
O 29 A E F G H M
P 32 L O
Q 55 B C E G I J L O P
R 42 A B D F G I K L M O
S 91 A D E F K L M P Q
T 20 B C F G M N P S
U 23 B D F G L M O P Q R S T
V 95 B D F G M N U
W 43 A B C H I K L M N O Q R S T U
X 32 F G K L N O R S T
Y 44 A C E F H I M N R S
Z 35 A B C D F I K N P Q X Y

A 99
B 51 A
C 83 B
D 76 A
E 21 A D
F 86 C E
G 48 B F
H 19 A D E F G
I 34 B C G
J 11 A C E H
K 30 C D E F I J
L 74 A B C F H I
M 67 A L
N 89 A B E I M
O 73 A B C F G I J M
P 48 C G J K N O
Q 41 C E G H M
R 56 A D E G I M Q
S 45 A B E F H J K M N R
T 64 G I J K N P R S
U 18 C G I L O P Q S
V 2 A F I L O Q R S
W 84 C D E G H K R S V
X 4 B D E G H K M N O P Q R T U W

A 58
B 80
C 50 A B
D 7 A B C
E 4 B D
F 53 C D E
G 74 C D
H 69 A G
I 52 A C F G
J 90 A C G I
K 50 A B C D F G I J
L 45 A B C E G H
M 99 A C D E F I J K
N 66 B D G H I J K L M
O 92 B D H J N
P 59 B C D I J K L N
Q 40 A B E F I J L
R 69 A C D F G H I O P Q
S 45 C E G J L N O R
T 41 A D G H I O P Q
U 75 B C D E H J K N O R S T
V 51 A D E F H I J N O R S T

A 35
B 81
C 42 A B
D 3 A B C
E 87 A
F 33 B E
G 43 A C D E
H 55 A B D

A 40
B 11
C 97 B
D 53 A B
E 73 B C D
F 70 C E
G 74 A B C D F
H 94 B E F
I 45 B D F H
J 24 D G H I
K 33 B E F H I J
L 80 C E G H I K
M 43 C G H I K L
N 34 A C E F H I L
O 31 F G H I M N
P 55 B J K L O
Q 79 B E F K M O P
R 73 C F G H K M N O Q

A 83
B 86 A
C 18 B
D 23 C
E 81 C
F 3 C D E
G 37 A B F
H 8 A C D F G
I 17 B D G
J 94 A E F G
K 49 E F G I J
L 15 B E F I K
M 15 B E J K
N 44 B C D G I K
O 79 A B C E H I N
P 91 B C D H I L M

A 17
B 41 A
C 85
D 3 B C
E 14 A B C
F 21 B D E
G 82 B F
H 66 C D E
I 57 A C G H
J 35 B G I
K 79 B C F G H J

A 12
B 34 A
C 69 B
D 69 A
E 99 B
F 55 A B E
G 11 A C E F
H 21 A C D

A 27
B 35
C 84 A
D 37 A
E 18 A D
F 69 B C
G 88 A B E
H 48 A G
I 88 A D G H
J 53 B D E G H
K 88 A B
L 72 B D F G H K
M 31 B F I J K L
N 63 A B E J L
O 43 A F G H K M N
P 23 C D F I K L O
Q 55 F G H I K M O
R 84 B C D F G K L M O P
S 65 C D E F H K M N Q
T 69 E F G J L M R S
U 97 B I L M O Q T
V 17 A D E F G J L M N P Q
W 29 A D E F J K L S T U
X 34 A C F J N P R T U W

A 98
B 85

A 72
B 91 A

A 1
B 79
C 81
D 91 A B
E 83 B C D
F 83 B D E
G 33 A B D E F
H 20 B C D E F
I 33 B C F H
J 98 A B C G H I
K 56 A C D E G I
L 32 C D E F H
M 9 A D F G J K
N 4 A B C E F H I
O 87 A B K
P 13 B D H I L N O
Q 74 E G H I J L M O
R 41 A B C F G I M
S 35 A B F H P
T 62 A D H I K M P R S
U 90 A H L R S T
V 3 A B C D E P R S U
W 9 B C H J K L O Q R T U V

A 53
B 90 A
C 61 A B
D 52 B
E 16 A D
F 49 D E

A 47
B 15
C 84 B
D 0 A C
E 69 A
F 19 A B C D
G 75 A F
H 15 A D F G
I 43 A C E G H
J 68 C D E F H I
K 82 A C E F G I
L 47 B C D E G J
M 64 B E F G J K
N 83 A B C E F G L

A 61
B 65 A
C 77

A 88
B 92
C 79
D 69 A B
E 58 B C
F 38 C
G 68 B C
H 4 F
I 59 H
J 96 B C D F G
K 90 C E F H I
L 12 E G H J K
M 69 B C H J L
N 98 A B C E F G I J K
O 92 C D G I J K M
P 96 C E F G H J

A 56
B 22
C 54 A
D 45 A B
E 26 A B D
F 12
G 99 A C D F
H 26 A D
I 24 A D F G H
J 27 A B C D E F
K 39 C E F H I J
L 13 A C D G H I
M 86 A B D E G H J
N 93 A B F G I J L
O 63 C E J K L M N
P 75 D G H I J N
Q 19 A C F I J M N O P
R 23 A C D E G I J Q
S 96 D G I M N Q R
T 84 B C D G K N P Q
U 68 A D E F G H N Q R T
V 13 A B F N P Q R T U
W 44 A B D G I K L M N O P R S U V
X 57 A D H I J K L N Q R S V W
Y 49 A D F H I J M N O S X

A 98
B 55 A
C 49 A
D 96 A C
E 93 A B C
F 74 A C E
G 38 A C D F
H 96 A E F G
I 81 A B C G H
J 23 B C D E F G I
K 39 B F J
L 42 C D F H I J K
M 62 B C D H J
N 83 A D E G H I J K M

A 27
B 94
C 41 B
D 39 B C
E 86 A B D
F 31 A C D E
G 44 A B C
H 9 A D G
I 69 A B C G
J 59 B C D E G I
K 14 A B H I

A 74
B 55
C 51 A
D 33
E 48 B C D
F 34 B C

A 80
B 68 A
C 13 A B
D 18 A
E 15 D
F 29 A B D E
G 15 A C D F
H 32 D E F
I 66 A B F H
J 4 A C D E F G I
K 12 B C F H I
L 11 A B E F G H J K
M 76 C D E G K
N 46 A C G I J K

A 36
B 17
C 12
D 93 A C
E 18 B C D
F 55 A D
G 12 A E
H 64 B D E G
I 21 B C D E F G
J 95 C E G
K 35 A B C D E H I
L 74 A C F H I J K
M 87 E F L
N 77 B F G J L M
O 9 A C E F G H
P 24 A B C D F G H J K L N O
Q 45 B F G I J M P
R 31 A C E L M O
S 73 A C D E G H J L N O
T 76 E F G H K M N O Q R S

A 39
B 76
C 80
D 79 C
E 25 C D
F 63 A D
G 37 A B C E
H 58 C E G
I 91 A B C D F G

A 14
B 95 A
C 94 B
D 31 B
E 46 D
F 23 B
G 95 A F
H 41 C D E F
I 78 A C D H
J 75 A B D E F I
K 64 A B C F H J
L 9 A C I J K
M 48 C D F J K L

A 75
B 53 A
C 53
D 14 A C
E 15 B C D
F 97 B C
G 16 B F
H 51 A B
I 46 B D G H
J 39 B D E G H
K 53 A D E F G H I J
L 3 C E F G I

A 45
stdout
824

739

81

402

1045

885

874

295

323

243

544

30

350

109

568

521

633

787

805

35

65

837

450

425

73

54

332

240

469

167

905

46

745

80

77

535

449

627

931

683

748

298

684

307

649

359

925

137

62

1010

22

198

119

604

418

89

35

350

165

617

79

664

415

227

95

683

534

434

424

500

198

679

304

198

722

774

827

165

837

574

346

211

745

98

163

666

260

481

126

452

748

703

252

173

363

645

272

518

340

45