// Przemysław Szpakowicz
#include <algorithm>
#define FOR(x, a, b) for(x = a; x < b; ++x)
const int MaxPacksAmount = 100000;
int BajteksWins[MaxPacksAmount];
int BajteksLosings[MaxPacksAmount];
void printBajteksOutcome(const int &packsAmount) {
int packIndex;
FOR(packIndex, 0, packsAmount)
if(BajteksWins[packIndex] == packsAmount) {
puts("WYGRANA");
return;
}
FOR(packIndex, 0, packsAmount)
if(BajteksLosings[packIndex] == 0) {
puts("REMIS");
return;
}
puts("PRZEGRANA");
}
void parseTest() {
int packsAmount, notTiesAmount;
scanf("%d%d", &packsAmount, ¬TiesAmount);
std::fill(BajteksWins, BajteksWins + packsAmount, 0);
std::fill(BajteksLosings, BajteksLosings + packsAmount, 0);
char packsRelationship[2];
int BajteksPackNumber, BiteksPackNumber;
while(notTiesAmount--) {
scanf("%d%s%d", &BajteksPackNumber, packsRelationship, &BiteksPackNumber);
if(packsRelationship[0] == '>')
++BajteksWins[BiteksPackNumber - 1];
else
++BajteksLosings[BiteksPackNumber - 1];
}
printBajteksOutcome(packsAmount);
}
int main() {
int testsAmount;
scanf("%d", &testsAmount);
while(testsAmount--)
parseTest();
}
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 | // Przemysław Szpakowicz #include <algorithm> #define FOR(x, a, b) for(x = a; x < b; ++x) const int MaxPacksAmount = 100000; int BajteksWins[MaxPacksAmount]; int BajteksLosings[MaxPacksAmount]; void printBajteksOutcome(const int &packsAmount) { int packIndex; FOR(packIndex, 0, packsAmount) if(BajteksWins[packIndex] == packsAmount) { puts("WYGRANA"); return; } FOR(packIndex, 0, packsAmount) if(BajteksLosings[packIndex] == 0) { puts("REMIS"); return; } puts("PRZEGRANA"); } void parseTest() { int packsAmount, notTiesAmount; scanf("%d%d", &packsAmount, ¬TiesAmount); std::fill(BajteksWins, BajteksWins + packsAmount, 0); std::fill(BajteksLosings, BajteksLosings + packsAmount, 0); char packsRelationship[2]; int BajteksPackNumber, BiteksPackNumber; while(notTiesAmount--) { scanf("%d%s%d", &BajteksPackNumber, packsRelationship, &BiteksPackNumber); if(packsRelationship[0] == '>') ++BajteksWins[BiteksPackNumber - 1]; else ++BajteksLosings[BiteksPackNumber - 1]; } printBajteksOutcome(packsAmount); } int main() { int testsAmount; scanf("%d", &testsAmount); while(testsAmount--) parseTest(); } |
English