Help needed (February Challenge 2020 Div-2) (The theatre problem)

I coded a greedy solution, which apparently works for other accepted solutions. This solution of mine received partial points only, here is my code, could anyone please point out what is wrong with it?

static class Pair{
    String s;
    int not;
    Pair(String s, int n){
this.s=s;
this.not=n;
    }
}


    public static void main(String[] args) throws java.lang.Exception {
        FastReader scn = new FastReader();
int t=scn.nextInt();
int[] prices ={100,75,50,25};
long total=0;
for(int i=0;i<t;i++){
    int n=scn.nextInt();
    Map<String,Integer> map = new HashMap<>();
    for(int k=0;k<n;k++){
        String s=scn.nextLine();
        map.put(s,map.getOrDefault(s, 0)+1);
    }
    Set<String> seen = new HashSet<>();
    Set<String> time = new HashSet<>();
    int j=0, cost=0;
    int nolosses;
    PriorityQueue<Pair> pq = new PriorityQueue<>((a,b)->(b.not-a.not));
    for(String s:map.keySet()){
        pq.add(new Pair(s,map.get(s)));
    }
    while(!pq.isEmpty() && j<4){
        Pair p=pq.poll();
        String[] arr = p.s.split(" ");
        if(seen.contains(arr[0])||time.contains(arr[1]))continue;
      seen.add(arr[0]);
      time.add(arr[1]);
      cost+=(prices[j])*p.not; 
        j++;
    }
    cost-=(4-seen.size())*100;
    total+=cost;
    System.out.print(cost+"\n");
}
System.out.print(total+"\n");
}