ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1718. Rejudge

Why crash on test #3
Posted by team5 2 Nov 2009 15:12
import java.util.HashSet;
import java.util.Locale;
import java.util.Scanner;
import java.util.Set;

public class m1718 {
    public static void main(String[] args)  {
        Locale.setDefault(Locale.US);
        Scanner sc=new Scanner(System.in);
        Set<String> maxS=new HashSet<String>();
        Set<String> minS=new HashSet<String>();
        int n=Integer.parseInt(sc.nextLine());
        String[] name=new String[n+1];
        String[] s=new String[n+1];
        int[] d=new int[n+1];
        for (int i = 0; i < n; i++) {
            name[i]=sc.next();
            s[i]=sc.nextLine();s[i].trim();
            if(s[i].charAt(1)=='A'){
                d[i]=0;
            }else {
                String[] s1=s[i].split(" ");
                d[i]=Integer.parseInt(s1[2]);
            }
        }
        for (int i = 0; i <n; i++) {
            if(d[i]==0) maxS.add(name[i]);
            if(d[i]>=6)maxS.add(name[i]);
            if(d[i]==7)minS.add(name[i]);
        }
        System.out.println(minS.size()+" "+maxS.size());
    }

}

Edited by author 02.11.2009 16:22