summaryrefslogtreecommitdiff
path: root/2010
diff options
context:
space:
mode:
authorYuval Adam <yuv.adm@gmail.com>2011-04-16 01:04:58 +0300
committerYuval Adam <yuv.adm@gmail.com>2011-04-16 01:04:58 +0300
commit30cf2661f549148e0a2ca65d0fe6d6984b66e0a7 (patch)
treebaa136d2ebedb8f2a84c49f34d94fe0210774517 /2010
parentbb5a25946ea31a8d2a109f2516a1ddc45c62ceef (diff)
dont need comments
Diffstat (limited to '2010')
-rw-r--r--2010/1a/1.out24
-rw-r--r--2010/1a/a.py14
2 files changed, 13 insertions, 25 deletions
diff --git a/2010/1a/1.out b/2010/1a/1.out
index 1f26e7a..df719e3 100644
--- a/2010/1a/1.out
+++ b/2010/1a/1.out
@@ -1,24 +1,8 @@
Case #1:
-.......
-.......
-.......
-R......
-RB.....
-BRB....
-RBBR...
+Blue
Case #2:
-......
-R.....
-BR....
-BRR...
-BBBR..
-BRBR..
+Blue
Case #3:
-....
-....
-BBB.
-RRRR
+Blue
Case #4:
-...
-RR.
-BBB
+Blue
diff --git a/2010/1a/a.py b/2010/1a/a.py
index c3f6aab..1e253ff 100644
--- a/2010/1a/a.py
+++ b/2010/1a/a.py
@@ -1,18 +1,22 @@
f = open('1.in', 'r')
o = open('1.out', 'w')
-# rotate *90 degrees clockwise*
def rotate(m):
n = len(m)
return [''.join([m[j][i] for j in range(n)[::-1]]) for i in range(n)]
-# drop a single row
def droprow(r):
return '.' * r.count('.') + r.replace('.','')
-# drop the rotated matrix
def gravity(m):
return map(droprow, m)
+
+def win(m):
+ win = 0
+ for (i, c) in ((1, 'B'), (2, 'R')):
+ win |= i
+
+ return ['Neither', 'Blue', 'Red', 'Both'][win]
t = int(f.readline().strip())
@@ -20,8 +24,8 @@ for i in range(t):
(n, k) = map(int, f.readline().strip().split(' '))
mat = [f.readline().strip() for j in range(n)]
- res = rotate(gravity(mat))
+ mat = rotate(gravity(mat))
- s = "Case #%d: \n%s\n" % (i+1, '\n'.join(res))
+ s = "Case #%d: \n%s\n" % (i+1, win(1))
print s
o.write(s)