#54316: C++


s11431141@nhsh.tp.edu.tw (161616)


#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;
}

不客氣