-
Notifications
You must be signed in to change notification settings - Fork 15
/
acm.java
47 lines (40 loc) · 1.27 KB
/
acm.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// https://open.kattis.com/problems/acm
import java.util.ArrayList;
import java.util.Scanner;
public class acm {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ArrayList<Integer> times = new ArrayList<>();
ArrayList<String> problems = new ArrayList<>();
ArrayList<String> states = new ArrayList<>();
while (true) {
int min = sc.nextInt();
if (min == -1)
break;
times.add(min);
problems.add(sc.next());
states.add(sc.next());
}
int size = times.size();
int correct = 0;
int totaltime = 0;
ArrayList<Integer> indexes = new ArrayList<>();
for (int x = 0; x < size; x++)
if (states.get(x).equals("right")) {
correct++;
totaltime += times.get(x);
indexes.add(x);
}
for (int s : indexes) {
int count = 0;
String answer = problems.get(s);
for (String x : problems)
if (x.equals(answer))
count++;
count--;
totaltime += count * 20;
}
System.out.println(correct + " " + totaltime);
sc.close();
}
}