I have a wrong answer in the New elements part 1 and I'm struggling to
understand what I missed. I basically wanted to do exactly what's described in
the analysis for the test set2, but I couldn't catch the bug :
t = int(input())
for case in range(t):
n = int(input())
C = []
J = []
for i in range(n):
ci,ji = input().split()
ci = int(ci)
ji= int(ji)
C.append(ci)
J.append(ji)
ratio_new_order = []
# Only parsing incoming data so far... The interesting part begin below.
for a in range(n):
for b in range(a + 1, n):
if (J[a] == J[b]):
# If they have the same J value, they always have the same
order, so I don't consider them.
# print("Those points are not permutable", i, j)
pass
else:
ratio = (C[b] - C[a])/(J[a] - J[b])
if ratio > 0:
# If the value is zero or below zero for this ratio, a and
b always appear in the same order.
# Otherwise, they change when k goes higher or below than
this ratio
ratio_new_order.append(ratio)
# print(set(potential_new_order))
# Using a set to remove non-unique elements from the ratio_new_order list,
and then computing its length.
result = len(set(ratio_new_order)) + 1
print('Case #{}: {}'.format(case + 1, result))
Would anybody have a clue of what's going wrong?
--
<https://artefact.com/fr-fr/events/vivatechnology-paris/>
This email and
any attachments contains privileged and confidential information intended
only for the use of the addressee(s). If you are not an intended recipient
of this email, you are hereby notified that any dissemination, copying or
use of information is strictly prohibited. If you received this email in
error or without authorization, please delete the email from your system
and notify us immediately by sending us an email. If you need any further
assistance, please send a message to [email protected]
<mailto:[email protected]>.
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/79b80c98-5343-42c5-94f2-119f83b757aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.