Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- typedef vector<int> vi;
- typedef vector<vi> vii;
- int main(){
- int cases, teams, m, h, v, i , j, winner, max;
- vi scores;
- vii matches;
- cin >> cases;
- for(int k = 0; k < cases; ++k){
- winner = max = 0;
- cin >> teams >> m;
- scores = vi(teams, 0);
- matches = vii(teams, vi(teams, -1));
- for(int p = 0; p < m; ++p){
- cin >> h >> v >> i >> j;
- ++matches[h][v];
- if(matches[h][v] == 0){
- if(i < j) scores[v] += 3;
- else if(i > j) scores[h] += 3;
- else{
- ++scores[h];
- ++scores[v];
- }
- }
- }
- for(int p = 0; p < teams; ++p){
- if(scores[p] > max){
- max = scores[p];
- winner = p;
- }
- }
- cout << winner << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement