Pages

Saturday, June 2, 2012

10420 - List of Conquests


//
// main.cpp
// 10420 - List of Conquests
//
// Created by Panks on 28/05/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#include <iostream>
#include <map>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

map<string, int> store;
vector<string> onlyplace;
bool cmpit(pair<string, int> a);
bool cmpit(pair<string, int> a){
return 0;
}

void printit(string place);
void printit(string place){

cout<<place<<" "<<store[place]<<endl;
}
int main (int argc, const char * argv[])
{
int t;
cin>>t;
getchar();
while (t--) {
string name, place;
cin>>place;
getchar();
getline(cin, name);
if (store[place]) {
store[place]++;
}else{
onlyplace.push_back(place);
store.insert(pair<string, int>(place, 100));
store[place]++;
}
}

sort(onlyplace.begin(), onlyplace.end());
for_each(onlyplace.begin(), onlyplace.end(), printit);
return 0;
}

No comments:

Post a Comment