Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
499 B
0
Indexable
Never
#include <iostream>

using namespace std;

int main()
{
    int N;
    cin>>N;
    int f[N];
    string s[N];
    for(int i = 0; i<N; i++){
        cin>>f[i]>>s[i];
    }
    int min = 2e9;
    int max = 0;
    for(int i = 0; i<N; i++){
        if(s[i]=="DA"){
            if(f[i]<min){
                min = f[i];
            }
        }
        else{
            if(f[i]>max){
                max = f[i];
            }
        }
    }
    cout<<max+1<<" "<<min-1;

}
Leave a Comment