summaryrefslogtreecommitdiff
path: root/2010/1c/a/a.py
diff options
context:
space:
mode:
authorYuval Adam <yuv.adm@gmail.com>2011-05-13 13:22:52 +0300
committerYuval Adam <yuv.adm@gmail.com>2011-05-13 13:22:52 +0300
commit6e536d154a28d958a50176230b4d128b9f940c4c (patch)
treea898497cdc2a2d46e63dda8de0b2e75c3d707876 /2010/1c/a/a.py
parent3431c199b36037eb8f920dd1069e4c58a36f8fc8 (diff)
moved a to dir
Diffstat (limited to '2010/1c/a/a.py')
-rw-r--r--2010/1c/a/a.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/2010/1c/a/a.py b/2010/1c/a/a.py
new file mode 100644
index 0000000..6a5f849
--- /dev/null
+++ b/2010/1c/a/a.py
@@ -0,0 +1,20 @@
+f = open('3.in', 'r')
+o = open('3.out', 'w')
+
+T = int(f.readline().strip())
+
+for t in xrange(T):
+ N = int(f.readline().strip())
+ w = [map(int, f.readline().strip().split(' ')) for _n in range(N)]
+
+ w.sort(key=lambda wire: wire[0])
+
+ cross = 0
+ for i in range(N):
+ for j in range(i+1, N):
+ if w[i][1] > w[j][1]:
+ cross += 1
+
+ s = "Case #%d: %s\n" % (t+1, cross)
+ print s
+ o.write(s)