Submission #432768


Source Code Expand

Copy
n, a, b = map(int, raw_input().split())
def move(d):
    if d < a:
        return a
    elif d > b:
        return b
    else:
        return d

pos = 0
for _ in xrange(n):
    data = raw_input().split()
    s = data[0]
    d = int(data[1])
    if s == "West":
        pos -= move(d)
    else:
        pos += move(d)
if pos < 0:
    print "West",
elif pos > 0:
    print "East",
print abs(pos)

Submission Info

Submission Time
Task B - 双子とスイカ割り
User sash
Language Python (2.7.3)
Score 100
Code Size 417 Byte
Status
Exec Time 58 ms
Memory 3392 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample-01.txt, sample-02.txt, sample-03.txt
All 100 / 100 test-01.txt, test-02.txt, test-03.txt, test-04.txt, test-05.txt, test-06.txt, test-07.txt, test-08.txt, test-09.txt, test-10.txt, test-11.txt, test-12.txt, test-13.txt, test-14.txt, test-15.txt, test-16.txt, test-17.txt, test-18.txt, test-19.txt, test-20.txt, test-21.txt, test-22.txt, test-23.txt, test-24.txt, test-25.txt, test-26.txt, test-27.txt, test-28.txt, test-29.txt, test-30.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
sample-01.txt 56 ms 3380 KB
sample-02.txt 54 ms 3388 KB
sample-03.txt 54 ms 3380 KB
test-01.txt 55 ms 3380 KB
test-02.txt 56 ms 3384 KB
test-03.txt 56 ms 3384 KB
test-04.txt 56 ms 3388 KB
test-05.txt 57 ms 3380 KB
test-06.txt 57 ms 3384 KB
test-07.txt 57 ms 3372 KB
test-08.txt 56 ms 3380 KB
test-09.txt 56 ms 3380 KB
test-10.txt 55 ms 3380 KB
test-11.txt 58 ms 3384 KB
test-12.txt 57 ms 3376 KB
test-13.txt 57 ms 3376 KB
test-14.txt 55 ms 3376 KB
test-15.txt 56 ms 3380 KB
test-16.txt 56 ms 3384 KB
test-17.txt 58 ms 3380 KB
test-18.txt 55 ms 3388 KB
test-19.txt 54 ms 3380 KB
test-20.txt 56 ms 3384 KB
test-21.txt 56 ms 3384 KB
test-22.txt 57 ms 3384 KB
test-23.txt 57 ms 3376 KB
test-24.txt 57 ms 3380 KB
test-25.txt 54 ms 3380 KB
test-26.txt 56 ms 3380 KB
test-27.txt 55 ms 3388 KB
test-28.txt 57 ms 3308 KB
test-29.txt 56 ms 3392 KB
test-30.txt 57 ms 3388 KB