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 | |
| parent | e851ef520b24d325cb79edcafc4aa3a6c2fb31bd (diff) | |
simple delta algorithm isnt enough
Diffstat (limited to '2010')
| -rw-r--r-- | 2010/1c/1.in | 17 | ||||
| -rw-r--r-- | 2010/1c/a.py | 16 |
2 files changed, 21 insertions, 12 deletions
diff --git a/2010/1c/1.in b/2010/1c/1.in index 1eae983..64c92f6 100644 --- a/2010/1c/1.in +++ b/2010/1c/1.in @@ -1,9 +1,8 @@ -4 -1 2 3 -abc -4 5 6 -def -7 8 9 -ghi -8 8 8 -jkl
\ No newline at end of file +2 +3 +1 10 +5 5 +7 7 +2 +1 1 +2 2
\ No newline at end of file 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) |
