#46523: c++ans


yp11151230@yphs.tp.edu.tw (909-42蔡亞儒)

學校 : 臺北市私立延平高級中學
編號 : 197211
來源 : [150.129.72.232]
最後登入時間 :
2025-07-09 18:05:16

#include<bits/stdc++.h>
using namespace std;

int main() {
    
    int n; // 總提交次數
    cin >> n;
    
    int max_score = -1; // 最高分數
    int max_time; // 第一次拿到最高分數的時間
    int wrong = 0; // 嚴重錯誤次數
    
    for(int i = 0; i < n; i++) {
        int t, s;
        cin >> t >> s; // 時間, 分數
        if(s > max_score) { // 比之前更高分
            // 更新
            max_score = s;
            max_time = t;
        }
        if(s == -1) { // 嚴重錯誤
            wrong++;    
        } 
    }
    
    int score = max(0, max_score - n - wrong * 2);
    cout << score << ' ' << max_time << '\n';
    
    return 0;
}