Rezultati

Up. imeNalogaJezikRezultatČas oddaje
scnm1-2018 Plezalne smeri Java 100/100OK 13. okt '18 @ 11:04

Test Točke Porabljen spomin Porabljen čas Status
#1 50/50 36,563 MiB 0,000 s OK
#2 50/50 36,926 MiB 0,000 s OK

Ocenjevani program (n1.java):
import java.util.*;
import java.io.*;

class smer implements Comparable<smer> {
	String ime;
	String diff;
	String[] q = { "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII" };
	String[] q2;
	int num;

	smer(String a, String b) {
		ime = a;
		diff = b;
		q2 = new String[3 * q.length];
		for (int i = 0; i < q.length; i++) {
			q2[3 * i] = q[i] + "-";
			q2[3 * i + 1] = q[i];
			q2[3 * i + 2] = q[i] + "+";
		}
		for (int i = 0; i < q2.length; i++) {
			if (q2[i].equals(diff)) {
				num = i;
			}
		}
	}

	@Override
	public int compareTo(smer arg0) {
		if (num != arg0.num) {
			return num - arg0.num;
		} else {
			return ime.compareTo(arg0.ime);
		}
	}
}

public class n1 {
	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		smer[] s = new smer[n];
		for (int i = 0; i < n; i++) {
			StringTokenizer st = new StringTokenizer(in.readLine());
			String s1 = st.nextToken();
			String s2 = st.nextToken();
			s[i] = new smer(s1, s2);
		}
		Arrays.sort(s);
		for (smer ss : s) {
			System.out.println(ss.ime);
		}
	}

}