import java.util.Scanner; public class kar { private static int[] bajtek = new int[100001]; private static int[] bitek = new int[100001]; public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); for (int i = 0; i < t; i++) { int n = s.nextInt(); int m = s.nextInt(); for (int j = 0; j < m; j++) { int baj = s.nextInt(); String winner = s.next(); int bit = s.nextInt(); if (">".equals(winner)) { bajtek[baj] = 1; } else { bitek[bit] = 1; } } int bajtekWins = 0; int bitekWins = 0; for (int j = 1; j <= n; j++) { bajtekWins += bajtek[j]; bitekWins += bitek[j]; } if (bajtekWins == n) { System.out.println("WYGRANA"); } else if (bitekWins == n) { System.out.println("PRZEGRANA"); } else { System.out.println("REMIS"); } for (int j = 1; j <= n; j++) { bajtek[j] = 0; bitek[j] = 0; } } } }
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 48 49 50 | import java.util.Scanner; public class kar { private static int[] bajtek = new int[100001]; private static int[] bitek = new int[100001]; public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); for (int i = 0; i < t; i++) { int n = s.nextInt(); int m = s.nextInt(); for (int j = 0; j < m; j++) { int baj = s.nextInt(); String winner = s.next(); int bit = s.nextInt(); if (">".equals(winner)) { bajtek[baj] = 1; } else { bitek[bit] = 1; } } int bajtekWins = 0; int bitekWins = 0; for (int j = 1; j <= n; j++) { bajtekWins += bajtek[j]; bitekWins += bitek[j]; } if (bajtekWins == n) { System.out.println("WYGRANA"); } else if (bitekWins == n) { System.out.println("PRZEGRANA"); } else { System.out.println("REMIS"); } for (int j = 1; j <= n; j++) { bajtek[j] = 0; bitek[j] = 0; } } } } |