#include <iostream> #include <algorithm> #include <map> #include <vector> using namespace std; struct Country{ string name; int score; vector<int> positions; }; bool operator <(Country A, Country B){ return A.score > B.score; } int main() { int i,pos; string name; map<string, int> index; vector<Country> countries; for(i=1;i<=100;i++){ cin>>pos>>name; int idx; if(index[name] == 0){ Country temp; temp.score = 0; countries.push_back(temp); idx = countries.size(); index[name] = idx; } else idx = index[name]; countries[idx-1].name = name; countries[idx-1].score += 101-pos; countries[idx-1].positions.push_back(pos); } sort(countries.begin(),countries.end()); for(i=0;i<countries.size();i++){ cout<<"=SPLIT(\""; cout<<i+1<<","<<countries[i].name; // for(int j=countries[i].name.length();j<15;j++) // cout<<" "; cout<<","; cout<<countries[i].score<<","; for(int j=0;j<countries[i].positions.size();j++){ cout<<countries[i].positions[j]; if(j+1<countries[i].positions.size()) cout<<" "; } cout<<"\", \",\")"; cout<<endl; } return 0; }
1 Serbia 2 Greece 3 Philippines 4 Argentina 5 Croatia 6 Hungary 7 Bulgaria 8 Iran 9 Greece 10 Romania 11 Serbia 12 Romania 13 Bulgaria 14 MKD 15 USA 16 MKD 17 Portugal 18 Chile 19 Romania 20 Slovenia 21 Russia 22 Hungary 23 Turkey 24 Poland 25 Germany 26 Spain 27 Slovenia 28 Russia 29 India 30 Croatia 31 Chile 32 Peru 33 Georgia 34 Venezuela 35 USA 36 Hungary 37 Serbia 38 MKD 39 Finland 40 Greece 41 Finland 42 Slovenia 43 Romania 44 Latvia 45 Spain 46 Romania 47 Poland 48 Croatia 49 Latvia 50 Argentina 51 Hungary 52 Greece 53 Peru 54 USA 55 Hungary 56 Bulgaria 57 Serbia 58 Croatia 59 Serbia 60 Serbia 61 Argentina 62 Hungary 63 Italy 64 Poland 65 Indonesia 66 Romania 67 Poland 68 Poland 69 Bulgaria 70 Japan 71 Hungary 72 Finland 73 Poland 74 Romania 75 USA 76 Turkey 77 Lithuania 78 Serbia 79 UK 80 Argentina 81 Spain 82 USA 83 Netherlands 84 NewZealand 85 Germany 86 Turkey 87 Hungary 88 Hungary 89 Serbia 90 Romania 91 Croatia 92 Italy 93 Romania 94 Romania 95 Ukraine 96 Bulgaria 97 Greece 98 Poland 99 Sweden 100 Taiwan
=SPLIT("1,Romania,463,10 12 19 43 46 66 74 90 93 94", ",")
=SPLIT("2,Hungary,431,6 22 36 51 55 62 71 87 88", ",")
=SPLIT("3,Serbia,416,1 11 37 57 59 60 78 89", ",")
=SPLIT("4,Greece,305,2 9 40 52 97", ",")
=SPLIT("5,Croatia,273,5 30 48 58 91", ",")
=SPLIT("6,Poland,266,24 47 64 67 68 73 98", ",")
=SPLIT("7,Bulgaria,264,7 13 56 69 96", ",")
=SPLIT("8,USA,244,15 35 54 75 82", ",")
=SPLIT("9,MKD,235,14 16 38", ",")
=SPLIT("10,Slovenia,214,20 27 42", ",")
=SPLIT("11,Argentina,209,4 50 61 80", ",")
=SPLIT("12,Chile,153,18 31", ",")
=SPLIT("13,Russia,153,21 28", ",")
=SPLIT("14,Spain,151,26 45 81", ",")
=SPLIT("15,Finland,151,39 41 72", ",")
=SPLIT("16,Turkey,118,23 76 86", ",")
=SPLIT("17,Peru,117,32 53", ",")
=SPLIT("18,Latvia,109,44 49", ",")
=SPLIT("19,Philippines,98,3", ",")
=SPLIT("20,Iran,93,8", ",")
=SPLIT("21,Germany,92,25 85", ",")
=SPLIT("22,Portugal,84,17", ",")
=SPLIT("23,India,72,29", ",")
=SPLIT("24,Georgia,68,33", ",")
=SPLIT("25,Venezuela,67,34", ",")
=SPLIT("26,Italy,47,63 92", ",")
=SPLIT("27,Indonesia,36,65", ",")
=SPLIT("28,Japan,31,70", ",")
=SPLIT("29,Lithuania,24,77", ",")
=SPLIT("30,UK,22,79", ",")
=SPLIT("31,Netherlands,18,83", ",")
=SPLIT("32,NewZealand,17,84", ",")
=SPLIT("33,Ukraine,6,95", ",")
=SPLIT("34,Sweden,2,99", ",")
=SPLIT("35,Taiwan,1,100", ",")