Help me in "That is my score!" problem. Problem code: WATSCORE

I am not able to understand the the arrays, for loops and if conditions in the below code for the problem. Please help. NOTE: The below code is correct.
include
using namespace std;

int main() {
int t; cin>>t; int k; int sum;
for(int i=1;i<=t;i++)
{
int n;
cin>>n;
int ar[11]={};

    for(int j=1;j<=n;j++)
    {
        int x,y;
        cin>>x>>y;
        
        
           if(y>ar[x-1]&&x!=9&&x!=10&&x!=11)
           {
             ar[x-1]=y;
             
           }
   
    }
    sum=0;
    for(int s=0;s<11;s++)
    {
        sum=sum+ar[s];
    }
    cout<<sum<<endl;
        
}
return 0;

}

@infinic
The logic is just initialize the whole 11 problem array with 0;
now when even u get a problem <9 then u will pick the max score for 9 .
and then sum up the maximum scores of all problems .