Created
January 16, 2020 22:47
-
-
Save liesen/bc59dd3e84707ca0bc94c5e0599f6dd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('gymnastics.in', 'r') as fin: | |
K, N = map(int, fin.readline().split()) | |
P = {k: {int(n): i for i, n in enumerate(fin.readline().split())} | |
for k in range(K)} | |
ans = 0 | |
for n1 in range(1, N + 1): | |
for n2 in range(1, N + 1): | |
if n1 == n2: | |
continue | |
if all(P[k][n1] < P[k][n2] for k in range(K)): | |
ans += 1 | |
with open('gymnastics.out', 'w') as fout: | |
print(ans, file=fout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment