<excludeFolder url="file://$MODULE_DIR$/Main/venv" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
- <orderEntry type="jdk" jdkName="Python 3.10 (CCC)" jdkType="Python SDK" />
+ <orderEntry type="jdk" jdkName="Python 3.10 (venv)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
- <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (CCC)" project-jdk-type="Python SDK" />
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (venv)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
--- /dev/null
+from math import pi, cos, sin
+from itertools import permutations
+
+
+def in_triangle(ax, ay, bx, by, cx, cy):
+ px, py = r, r
+ try:
+ w1 = (ax * (cy - ay) + (py - ay) * (cx - ax) - px * (cy - ay)) / ((by - ay) * (cx - ax) - (bx - ax) * (cy - ay))
+ w2 = (py - ay - w1 * (by - ay)) / (cy - ay)
+ except:
+ return False
+
+ if w1 > 0 and w2 > 0 and w1 + w2 < 1:
+ return True
+ return False
+
+
+N, C = tuple(map(int, input().split()))
+r = C / (2 * pi)
+
+
+def to_coordinates(p):
+ angle = p / C * 2 * pi
+ return r * cos(angle) + r, r * sin(angle) + r
+
+
+temp = {i + 1: int(val) for i, val in enumerate(input().split())}
+P = {i:to_coordinates(temp[i]) for i in temp.keys()}
+
+seen = set()
+
+output = []
+for subset in permutations(P.keys(), 3):
+ # print(subset)
+ a, b, c = subset
+ ax, ay = P[a]
+ bx, by = P[b]
+ cx, cy = P[c]
+
+ if in_triangle(ax, ay, bx, by, cx, cy):
+ if subset not in seen:
+ output.append(subset)
+ else:
+ if subset in seen:
+ for s in permutations(subset, 3):
+ if s in output:
+ output.remove(s)
+ for s in permutations(subset,3):
+ seen.add(s)
+
+
+def is_opposite(a,b):
+ print(a,b, C-1)
+ if abs(temp[a] - temp[b]) == C/2:
+ return True
+ return False
+
+for i in output:
+ for a,b in permutations(i, 2):
+ if is_opposite(a,b):
+ output.remove(i)
+ break
+
+
+print(len(output), output)