fork download
  1. using System;
  2. using System.IO;
  3. using System.Collections.Generic;
  4.  
  5. public class Polygon
  6. {
  7. static List<int>[] cross;
  8. static int x, y;
  9. static UInt64 A, P;
  10. static char orientation;
  11. static int Max_index(int[] p)
  12. {
  13. int max = 0, idx = 0;
  14. for (int i = 1; i < p.Length; i++)
  15. {
  16. if (p[i] >= max && cross[i].Count > 0) { max = p[i]; idx = i; }
  17. }
  18. return idx;
  19. }
  20. static int Min_index(int[] p)
  21. {
  22. int min = 6001, idx=0;
  23. for (int i = 0; i < p.Length; i++)
  24. {
  25. if (p[i] <= min && cross[i].Count > 0) { min = p[i]; idx = i; }
  26. }
  27. return idx;
  28. }
  29. static void move(string s)
  30. {
  31. for (int i = 0; i < s.Length; i++)
  32. {
  33. if (s[i] == 'R')
  34. {
  35. if (orientation == 'U') orientation = 'R';
  36. else if (orientation == 'R') orientation = 'D';
  37. else if (orientation == 'D') orientation = 'L';
  38. else orientation = 'U';
  39. }
  40. if (s[i] == 'L')
  41. {
  42. if (orientation == 'U') orientation = 'L';
  43. else if (orientation == 'R') orientation = 'U';
  44. else if (orientation == 'D') orientation = 'R';
  45. else orientation = 'D';
  46. }
  47. if (s[i] == 'F')
  48. {
  49. if (orientation == 'U') y++;
  50. else if (orientation == 'R') { cross[x].Add(y); x++; }
  51. else if (orientation == 'D') y--;
  52. else if (orientation == 'L') { x--; cross[x].Add(y); }
  53. }
  54. }
  55. }
  56. static void Main()
  57. {
  58. int L;
  59. int[] max, min;
  60. L = int.Parse(Console.ReadLine());
  61. x = 3001; y = 3001; orientation = 'U';
  62. cross=new List<int>[6002];
  63. for (int i = 0; i < 6002; i++) cross[i] = new List<int>();
  64. while (L > 0)
  65. {
  66. string[] p = Console.ReadLine().Split(' ');
  67. for (int i = 0; i < p.Length - 1; i = i + 2)
  68. {
  69. for (int j = 0; j < int.Parse(p[i + 1]); j++) move(p[i]);
  70. }
  71. L -= (p.Length / 2);
  72. }
  73. A = 0;
  74. for (int i = 0; i < 6002; i++)
  75. {
  76. cross[i].Sort();
  77. for (int j = 0; j < cross[i].Count; j = j + 2)
  78. {
  79. A += (UInt64)(cross[i][j + 1] - cross[i][j]);
  80. }
  81. }
  82. max = new int[6002]; min = new int[6002];
  83. for (int i = 0; i < 6002; i++)
  84. {
  85. int len=cross[i].Count;
  86. if (len > 0) max[i] = cross[i][len - 1];
  87. else max[i] = 3001;
  88. if (len > 0) min[i] = cross[i][0];
  89. else min[i] = 3001;
  90. }
  91. int idx = Max_index(max);
  92. int step = 0;
  93. for (int i = 0; i <= idx; i++)
  94. {
  95. if (cross[i].Count > 0 && max[i] > step) step = max[i];
  96. else if (cross[i].Count > 0 && max[i] < step) max[i] = step;
  97. }
  98. step = 0;
  99. for (int i = 6001; i >= idx; i--)
  100. {
  101. if (cross[i].Count > 0 && max[i] > step) step = max[i];
  102. else if (cross[i].Count > 0 && max[i] < step) max[i] = step;
  103. }
  104. idx = Min_index(min); step = 6001;
  105. for (int i = 0; i <= idx; i++)
  106. {
  107. if (cross[i].Count > 0 && min[i] > step) min[i] = step;
  108. else if (cross[i].Count > 0 && min[i] < step) step = min[i];
  109. }
  110. step = 6001;
  111. for (int i = 6001; i >= idx; i--)
  112. {
  113. if (cross[i].Count > 0 && min[i] > step) min[i] = step;
  114. else if (cross[i].Count > 0 && min[i] < step) step = min[i];
  115. }
  116. P = 0;
  117. for (int i = 0; i < cross.Length; i++)
  118. {
  119. P += (UInt64)(max[i] - min[i]);
  120. }
  121. for (int i2 = 1; i2 < 2; i2++) {
  122. for (int j2 = 1; j2 < 2; j2++) {
  123. Console.WriteLine("{0} ",cross(0,0));
  124. }
  125. Console.WriteLine();
  126. }
  127. }
  128. }
Compilation error #stdin compilation error #stdout 0.02s 15024KB
stdin
10 
FFLFRFRFFLFLFRFF 5 L 1 FFFRFLFLFRFF 4 L 1 FFLFRFRFFLFLFRFF 8 L 1 FFLFRFRFFLFLFRFF 4 L 1 FFFFFF 3 R 1
compilation info
prog.cs(123,44): error CS0118: `Polygon.cross' is a `field' but a `method group' was expected
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty