Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <utility>
- #include <string>
- using namespace std;
- int main () {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- map<int, string> tree;
- int N;
- cin >> N;
- for (int i = 1; i <= N; i++) {
- string temp;
- cin >> temp;
- tree.insert( make_pair( i, temp ) );
- }
- int M;
- cin >> M;
- for (int T = 0; T < M; T++) {
- char op; cin >> op;
- if (op == 'P') {
- int pos; cin >> pos;
- auto it = tree.lower_bound( pos );
- cout << it->second << '\n';
- }
- else if(op == 'M'){
- int pos; cin >> pos;
- auto it = tree.lower_bound( pos );
- tree.erase(it);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement