[ create a new paste ] login | about

Link: http://codepad.org/c71qZXvX    [ raw code | output | fork ]

C++, pasted on Jan 14:
#include<iostream>
#include<set>
#include<string>
#include<utility>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

int main(){
    set<pair<int, string>> people;
    int n;
    cin >> n;
    while(n--){
        int age;
        string name, buf;
        cin >> buf;
        if(buf == "born"){
            cin >> name >> age;
            people.insert(make_pair(age, name));
        }
        else if(buf == "find"){
            cin >> name >> age;
            if(people.find(make_pair(age, name)) != people.end())  cout << "YES" << endl;
            else cout << "NO" << endl;
        }
        else if(buf == "kill"){
            cin >> name >> age;
            people.erase(make_pair(age, name));
        }
        else {
            if(!people.empty()){
                cout << (people.begin())->second << ' ' << (people.begin())->first << endl;
            }
        }
    }
    return 0;
}


Output:
1
2
3
In function 'int main()':
Line 10: error: 'people' was not declared in this scope
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: