# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222404 | shenxy | ACM (COCI19_acm) | Java | 409 ms | 30136 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import java.util.*;
import java.io.*;
public class acm {
private static class IntPair implements Comparable<IntPair> {
public int a, b;
public IntPair(int a, int b) {
this.a = a;
this.b = b;
}
public int compareTo(IntPair i) {
if (i.a != this.a) return this.a - i.a;
return i.b - this.b;
}
}
private static class Ranking implements Comparable<Ranking> {
public String team;
public IntPair score;
public Ranking(String team, IntPair score) {
this.team = team;
this.score = score;
}
public int compareTo(Ranking i) {
if (this.score.compareTo(i.score) != 0) return this.score.compareTo(i.score);
return i.team.compareTo(this.team);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt(), M = sc.nextInt();
ArrayList<Ranking> arr = new ArrayList<Ranking>();
for (int i = 0; i < N; ++i) {
String team = sc.next();
IntPair score = new IntPair(0, 0);
for (int j = 0; j < M; ++j) {
String res = sc.next();
if (res.charAt(0) != '-') {
++score.a;
int time = 0;
time += 1200 * (res.charAt(1) - '0');
time += 3600 * Integer.parseInt(res.substring(3, 5)) + 60 * Integer.parseInt(res.substring(6, 8)) + Integer.parseInt(res.substring(9, 11));
score.b += time;
}
}
if (!team.equals("NijeZivotJedanACM")) arr.add(new Ranking(team, score));
}
Collections.sort(arr);
Ranking nijeRanking;
String team = sc.next();
IntPair score = new IntPair(0, 0);
for (int j = 0; j < M; ++j) {
String res = sc.next();
if (res.charAt(0) != '-') {
++score.a;
int time = 0;
time += 1200 * (res.charAt(1) - '0');
time += 3600 * Integer.parseInt(res.substring(3, 5)) + 60 * Integer.parseInt(res.substring(6, 8)) + Integer.parseInt(res.substring(9, 11));
score.b += time;
}
}
nijeRanking = new Ranking(team, score);
for (int i = 1; i <= arr.size(); ++i) {
if (nijeRanking.compareTo(arr.get(arr.size() - i)) > 0) {
System.out.println(i);
return;
}
}
System.out.println(N);
return;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |