Click
Here to go back to the homepage.
ACM Contest Scoring Solution:
import java.util.*;
public class CodeJam {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
HashMap<String, Integer> hm = new HashMap<>();
int result = 0;
int correct = 0;
while(true){
String[] line = sc.nextLine().split(" ");
if(line[0].equals("-1"))
break;
if(line[2].equals("wrong")){
if(hm.containsKey(line[1])){
int temp = hm.get(line[1]);
hm.put(line[1], temp+1);
}
else
hm.put(line[1], 1);
}
else{
correct++;
result += hm.containsKey(line[1])? Integer.parseInt(line[0]) + (hm.get(line[1]) * 20): Integer.parseInt(line[0]);
}
}
System.out.println(correct + " "+ result);
}
}