daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Dec 17th, 2018 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include<vector>
  3. #include<map>
  4. #include<fstream>
  5. using namespace std;
  6. int main(){
  7.     ifstream in;
  8.     ofstream ou;
  9.     in.open("input.txt");
  10.     ou.open("output.txt");
  11.     int n;
  12.     int n1;
  13.     in>>n;
  14.     in>>n1;
  15.     map<string,string> m;
  16.     string a,b;
  17.     for(int i=0;i<n;i++){
  18.         in>>a;
  19.         in>>b;
  20.         m[a]=b;
  21.     }
  22.     int c,d;
  23.     map<string,int> m1;
  24.     for(int i=0;i<n1;i++){
  25.       in>>a;
  26.       in>>b;
  27.       in>>c;
  28.       in>>d;
  29.       if(c==d){
  30.           m1[m[a]]+=2;
  31.           m1[m[b]]+=2;
  32.       }else if(c>d){
  33.           m1[m[a]]+=4;
  34.           m1[m[b]]+=1;
  35.       }else{
  36.           m1[m[b]]+=4;
  37.           m1[m[a]]+=1;
  38.       }
  39.     }
  40.     pair<string,int> finale;
  41.     while(m1.size()!=0){
  42.         finale.first="";
  43.         finale.second=-1;
  44.         for(auto i:m1){
  45.             if(i.second>finale.second){
  46.                 finale.second=i.second;
  47.                 finale.first=i.first;
  48.             }
  49.         }
  50.         ou<<finale.first<<" "<<finale.second<<endl;
  51.         m1.erase(finale.first);
  52.     }
  53.     return 0;
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top