Guest User

Untitled

a guest
Jan 15th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.60 KB | None | 0 0
  1. //#pragma comment(linker, "/STACK:16777216")
  2.  
  3. #include <iostream>
  4. #include <fstream>
  5. #include <algorithm>
  6. #include <cmath>
  7. #include <vector>
  8. #include <queue>
  9. #include <string>
  10. #include <set>
  11. #include <map>
  12. #include <cstdlib>
  13. using namespace std;
  14.  
  15. #define INF 2000000000
  16.  
  17. typedef long long llong;
  18.  
  19.  
  20. template <class T> T sqr(T x){return  x*x;}
  21.  
  22. int n, fullScore[1000], in[1000], out[1000], score[1000];
  23.  
  24. int main(){
  25.     freopen("input.txt","r",stdin);
  26.     freopen("output.txt","w",stdout);
  27.     ios_base::sync_with_stdio(0);
  28.     cin >> n;
  29.     for (int i = 1; i <= n; ++i){
  30.         cin >> fullScore[i];
  31.         score[i] = 0; in[i] = 0; out[i] = 0;
  32.     }
  33.     int m = n*(n-1)-1, maxIn = 0, maxOut;
  34.     for (int i = 1; i <= m; ++i){
  35.         int l, r; char sim;
  36.         cin >> l >> r >> sim;
  37.         ++in[l]; ++out[r];
  38.         if (sim == '0') {
  39.             ++score[l]; ++score[r];
  40.         }
  41.         if (sim == '-') score[r] += 3;
  42.         if (sim == '+') score[l] += 3;
  43.         if (sim != '0') cin >> sim;
  44.         maxIn = max(maxIn, max(in[l], in[r]));
  45.         maxOut = max(maxOut, max(out[l], out[r]));
  46.     }
  47.     int first, second;
  48.     for (int i = 1; i <= n; ++i){
  49.         if (in[i] != maxIn) first = i;
  50.         if (out[i] != maxOut) second = i;
  51.     }
  52.     if (fullScore[first] - score[first] == 1){
  53.         cout << first << " " << second << " " << "0";
  54.     }
  55.     if (fullScore[first] - score[first] == 3){
  56.         cout << first << " " << second << " +" <<1;
  57.     }
  58.     if (fullScore[first] - score[first] == 0){
  59.         cout << first << " " << second << " -" << 1;
  60.     }
  61.     return 0;
  62. }
Add Comment
Please, Sign In to add comment