Editorial for CCC '16 J1 - Tournament Selection


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

The problem is asking for the number of W characters, which can be obtained by keeping a counter and then printing the correct group number with an if statement.

Time Complexity: \mathcal{O}(1)


Comments


  • 0
    shixint122  commented on Feb. 3, 2025, 7:03 p.m.

    g_1 = (input()) g_2 = (input()) g_3 = (input()) g_4 = (input()) g_5 = (input()) g_6 = (input())

    def win(s): if s == "W": return 1 else: return 0

    total = win(g_1) + win(g_2) + win(g_3) + win(g_4) + win(g_5) + win(g_6)

    if total > 4: print(1) elif total > 2 : print(2) elif total > 0: print(3) else: print(-1)