Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- //#include <bits/stdc++.h>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- vector<pair<int, string> > v;
- for(int i = 0; i < n; i++) {
- int x;
- cin >> x;
- string s;
- cin >> s;
- v.push_back(make_pair(x, s));
- }
- sort(v.begin(), v.end());
- int posledno_ne = 0, prvo_da = -1;
- for(int i = 0; i < v.size(); i++) {
- if(v[i].second == "NE") {
- posledno_ne = v[i].first;
- }
- else {
- prvo_da = v[i].first;
- break;
- }
- }
- cout << posledno_ne + 1 << " " << prvo_da - 1 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement