SHARE
TWEET

UCL Tester

deadwing97 Mar 25th, 2019 341 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int T;
  6.  
  7. map < string , int > pts , goals;
  8.  
  9. bool cmp(const string &a , const string &b){
  10.     if(pts[a] > pts[b]) return 1;
  11.     if(pts[a] < pts[b]) return 0;
  12.     if(goals[a] > goals[b]) return 1;
  13.     return 0;
  14. }
  15. int main(){
  16.     cin>>T;
  17.     while(T--){
  18.         pts.clear();
  19.         goals.clear();
  20.         set < string > teams;
  21.         for(int j = 0 ; j < 12 ; j++){
  22.             string team1 , team2 , tok;
  23.             int g1 , g2;
  24.             cin>>team1>>g1>>tok>>g2>>team2;
  25.             if(g1 > g2) pts[team1] += 3;
  26.             else if(g1 < g2) pts[team2] += 3;
  27.             else pts[team1]++ , pts[team2]++;
  28.             goals[team1] += g1 - g2;
  29.             goals[team2] += g2 - g1;
  30.             teams.insert(team1);
  31.             teams.insert(team2);
  32.         }
  33.  
  34.         vector < string > v(teams.begin() , teams.end());
  35.         sort(v.begin() , v.end() , cmp);
  36.         cout<<v[0]<<' '<<v[1]<<endl;
  37.     }
  38.  
  39. }
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