Editorial for Valentine's Day '18 J3 - Are they cute?


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.

Author: kipply

The key phrase in this problem is "they must be cuter than more than half of the people present".

Thus the solution can be coded to iterate through all the people, and per person count the number of people who are cuter. With just that, one would have to compare it to n / 2 which leaves room for error, thus the solution below simply adds 2 for each cuter person.

for i in range(n):
    cuter = 0
    for j in range(n):
        if cuteness[i] > cuteness[j]:
            cuter += 2
    if cuter > n:
        print(names[i] + " is cute! <3")
    else:
        print(names[i] + " is not cute. </3")

Comments


  • 2
    Mohab_Osman13  commented on Oct. 14, 2019, 7:28 p.m.

    what language is this


    • 4
      Aaeria  commented on Oct. 15, 2019, 12:19 a.m.

      You probably shouldn't try to submit the editorial as your solution though


    • 4
      wleung_bvg  commented on Oct. 14, 2019, 7:49 p.m.

      Python 3


      • 1
        Zeyu  commented on Oct. 14, 2019, 7:58 p.m.

        What if it was PyPy3