Advertisement
Guest User

Grup Piala Dunia

a guest
Nov 15th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. //In The Name of Allah
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     ios::sync_with_stdio(0);
  8.     cin.tie(0);
  9.     int tc;
  10.     cin >> tc;
  11.     while(tc--)
  12.     {
  13.         int N;
  14.         int scoreboard[10][5];
  15.         int arr[10];
  16.         cin >> N;
  17.         int win = 0;
  18.         int lose = 0;
  19.         int seri = 0;
  20.         int match = N-1;
  21.         for(int i = 1 ; i <= N ; i++){
  22.             cin >> arr[i];
  23.             scoreboard[i][1] = arr[i]/3; // total match menang
  24.             scoreboard[i][2] = arr[i]%3; // total match seri
  25.             scoreboard[i][3] = match - (scoreboard[i][1] + scoreboard[i][2]); // total match kalah
  26.             win += scoreboard[i][1];
  27.             lose += scoreboard[i][3];
  28.             seri += scoreboard[i][2];
  29.         }
  30.         if((win == lose) && (seri%2==0))cout << "YES" << '\n';
  31.         else cout << "NO" << '\n';
  32.     }
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement