---
# System prepended metadata

title: 寒假Apcs訓練 1/25

---


##### j605. 1. 程式考試
---
```python=
n = int(input())
ma = -1
k = 0
z = 0
for i in range(n):
    a,b = map(int,input().split())
    if b == -1:
        k +=1
    if b > ma:
        ma = b
        z = a
u = ma -n - k * 2
if u < 0:
    u = 0
print(u,z)
```
j123. 2. 運貨站
===
##### 參考吳邦一教授的方式寫出來的他列出了三種不同的情況 教授的代碼只有19行非常簡短非常厲害
---
```python=
r, c, n = map(int,input().split())
storehouse =[[0 for i in range(c)] for i in range(r)]
z = [0] * r
s = 0 #空白的方塊
t = 0 #放不進去的數量
for i in range(n):
    a, b = map(str,input().split())
    b = int(b)
    if a == "A":
        ma = -1
        for i in range(b,b+4):
            ma = max(z[i],ma)
        if ma + 1 <= c:
            for i in range(b,b+4):
                z[i] = ma + 1
            s += 4
        else: t += 1
    elif a == "B":
        if z[b] + 3 <= c:
            z[b] += 3
            s += 3
        else: t += 1
    elif a == "C":
        ma = -1
        for i in range(b,b+2):
            ma = max(z[i],ma)
        if ma + 2 <= c:
            for i in range(b,b+2):
                    z[i] = ma + 2
            s += 4
        else: t += 1
    elif a == "D":
        ma = max(z[b] + 1,z[b+1] + 3)
        if ma <= c:
            for i in range(b,b+2):
                    z[i] = ma
            s += 4
        else: t += 1
    elif a == "E":
        ma = max(z[b] + 1,z[b+1] + 2,z[b+2] + 2)
        if ma <= c:
            for i in range(b,b+3):
                    z[i] = ma
            s += 5
        else: t += 1
print(r * c - s,t)
```