#include <stdio.h> int countWin[100000]; int countDraw[100000]; void run(); int main() { int t; scanf("%i", &t); for(int i = 0; i < t; ++i) run(); return 0; } void run(){ int n; int m; scanf("%i %i", &n, &m); for(int i = 0; i < n; i++) { countWin[i] = 0; countDraw[i] = n; } for(int i = 0; i < m; i++) { int a; char w; int b; scanf("%i %c %i", &a, &w, &b); if(w == '<') countDraw[b-1]--; else countWin[b-1]++; } bool win = false; bool draw = false; for(int i = 0; i < n; i++){ if(countWin[i] == n) { win = true; break; } else if (countDraw[i] == n){ draw = true; } } if(win) printf("WYGRANA\n"); else if(draw) printf("REMIS\n"); else printf("PRZEGRANA\n"); }
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 51 52 53 | #include <stdio.h> int countWin[100000]; int countDraw[100000]; void run(); int main() { int t; scanf("%i", &t); for(int i = 0; i < t; ++i) run(); return 0; } void run(){ int n; int m; scanf("%i %i", &n, &m); for(int i = 0; i < n; i++) { countWin[i] = 0; countDraw[i] = n; } for(int i = 0; i < m; i++) { int a; char w; int b; scanf("%i %c %i", &a, &w, &b); if(w == '<') countDraw[b-1]--; else countWin[b-1]++; } bool win = false; bool draw = false; for(int i = 0; i < n; i++){ if(countWin[i] == n) { win = true; break; } else if (countDraw[i] == n){ draw = true; } } if(win) printf("WYGRANA\n"); else if(draw) printf("REMIS\n"); else printf("PRZEGRANA\n"); } |