n=int(input())#讀次數
maxs=float('-inf') # 用來記錄最大成績的值,初始為負無限大
maxt=0 # 對應最大成績時的時間
c=0 # 計數嚴重錯誤的次數
for i in range(n):#執行迴圈
t,s=map(int,input().split())#讀成績和時間
if s>maxs:#若是最大成績
maxs=s#更新最大成績
maxt=t#更新最大成績的時間
if s<0:#若是嚴重錯誤
c+=1#增加嚴重錯誤次數
print(max(maxs-n-c*2,0),maxt)#印出最大成績減去提交次數、嚴重錯誤次數×2若為負數為0,和最大成績的時間
• 如果 s 比目前最大值還大,更新 maxs 和 maxt。
• 如果 s 小於 0,計數器 c 加一。
6.最後輸出兩個值:
•第一個值是計算公式:max(maxs - n - c * 2, 0)
,確保結果不小於 0。
•第二個值是對應最大 s 時的 t。
😼看懂了嗎😼