Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#pragma comment(linker, "/STACK:16777216")
- #include <iostream>
- #include <fstream>
- #include <algorithm>
- #include <cmath>
- #include <vector>
- #include <queue>
- #include <string>
- #include <set>
- #include <map>
- #include <cstdlib>
- using namespace std;
- #define INF 2000000000
- typedef long long llong;
- template <class T> T sqr(T x){return x*x;}
- int n, fullScore[1000], in[1000], out[1000], score[1000];
- int main(){
- freopen("input.txt","r",stdin);
- freopen("output.txt","w",stdout);
- ios_base::sync_with_stdio(0);
- cin >> n;
- for (int i = 1; i <= n; ++i){
- cin >> fullScore[i];
- score[i] = 0; in[i] = 0; out[i] = 0;
- }
- int m = n*(n-1)-1, maxIn = 0, maxOut;
- for (int i = 1; i <= m; ++i){
- int l, r; char sim;
- cin >> l >> r >> sim;
- ++in[l]; ++out[r];
- if (sim == '0') {
- ++score[l]; ++score[r];
- }
- if (sim == '-') score[r] += 3;
- if (sim == '+') score[l] += 3;
- if (sim != '0') cin >> sim;
- maxIn = max(maxIn, max(in[l], in[r]));
- maxOut = max(maxOut, max(out[l], out[r]));
- }
- int first, second;
- for (int i = 1; i <= n; ++i){
- if (in[i] != maxIn) first = i;
- if (out[i] != maxOut) second = i;
- }
- if (fullScore[first] - score[first] == 1){
- cout << first << " " << second << " " << "0";
- }
- if (fullScore[first] - score[first] == 3){
- cout << first << " " << second << " +" <<1;
- }
- if (fullScore[first] - score[first] == 0){
- cout << first << " " << second << " -" << 1;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment