Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- using namespace std;
- int main(){
- string nome;
- int N, poder;
- map<int, string> item;
- map<string, int> sort;
- cin>>N;
- for(int i=0; i<N; i++){
- cin>>poder;
- cin.ignore();
- getline(cin, nome);
- item[poder] = nome;
- }
- map<int, string>::iterator it;
- for(it = item.begin(); it != item.end(); it++){
- sort[(*it).second] = (*it).first;
- }
- map<string, int>::iterator it1;
- for(it1 = sort.begin(); it1 != sort.end(); it1++){
- cout<<(*it1).first<< " " << (*it1).second<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement