Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <algorithm>
- using namespace std;
- short rl(short campionato[], short N, short M)
- {
- short i=0;
- short pos=-1;
- while(i<N && pos==-1)
- {
- if(campionato[i] == M)
- pos = i;
- i++;
- }
- return pos;
- }
- int main()
- {
- short N;
- short s1, s2, g1, g2;
- ifstream input;
- ofstream output;
- input.open("input.txt");
- output.open("output.txt");
- input >> N;
- short campionato[N] = {0};
- for(int i=0; i<N*(N-1)/2; i++)
- {
- input >> s1 >> s2 >> g1 >> g2;
- if(g1>g2) campionato[s1] += 3;
- else if(g1==g2) { campionato[s1]+=1; campionato[s2]+=1; }
- else campionato[s2] += 3;
- }
- short M = *max_element(campionato, campionato+N);
- output << rl(campionato,N,M) << ' ' << M;
- input.close();
- output.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement