diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2011-05-13 13:07:40 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2011-05-13 13:07:40 +0300 |
| commit | 1ea1751b5349ede8f3c7a5f633ddaf178e472e79 (patch) | |
| tree | 378af3942cfb7ae12497a7224eed1702e1b0b9e2 /2010/1c/a.py | |
| parent | e851ef520b24d325cb79edcafc4aa3a6c2fb31bd (diff) | |
simple delta algorithm isnt enough
Diffstat (limited to '2010/1c/a.py')
| -rw-r--r-- | 2010/1c/a.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/2010/1c/a.py b/2010/1c/a.py index 7bc039a..eb1bb67 100644 --- a/2010/1c/a.py +++ b/2010/1c/a.py @@ -4,10 +4,20 @@ o = open('1.out', 'w') T = int(f.readline().strip()) for t in xrange(T): - (n, m, o) = map(int, f.readline().strip().split(' ')) - l = f.readline().strip() + N = int(f.readline().strip()) + wires = [] + for n in range(N): + wires.append(map(int, f.readline().strip().split(' '))) + + wires.sort(key=lambda wire: wire[0]) + + cross = 0 + bwires = [x[1] for x in wires] + print bwires + bwd = [bwires[i+1]-bwires[i] for i in range(len(bwires)-1)] + print bwd + res = len([x for x in bwd if x < 0]) - res = str(n) + str(m) + str(o) + l s = "Case #%d: %s\n" % (t+1, res) print s #o.write(s) |
