OJ-Problems-Source/Codeforces/Gym/100819N.cpp
2016-08-13 17:14:13 +08:00

29 lines
403 B
C++

#include <iostream>
#include <string>
using namespace std;
string str;
int main()
{
int n,k;
cin>>n>>k;
int x=1;//safe
int y=k;//break
for(int i=0;i<n;i++)
{
int t;
cin>>t>>str;
if(str.at(0)=='B')
{
if(t<y) y=t;
}
else
{
if(t>x) x=t;
}
}
cout<<x+1<<" "<<y-1<<endl;
return 0;
}