Submission #222400

# Submission time Handle Problem Language Result Execution time Memory
222400 2020-04-13T06:32:41 Z shenxy ACM (COCI19_acm) C++11
Compilation error
0 ms 0 KB
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;
    }
}

Compilation message

acm.cpp:1:1: error: expected unqualified-id before 'public'
 public class acm {
 ^~~~~~