On Thursday, 18 April 2019 21:25:25 UTC+2, Juarez Paulino wrote: > Hi Andre, > > > I had the same solution written in c++. > > > Check for squared matrices with even order (r==c and r%2==0, like 4x4), > specifically for placement on last column. > > > Hope it helps, > > > Juarez Paulino > > > On Thu, Apr 18, 2019 at 2:26 PM 'André Bienemann' via Google Code Jam > <[email protected]> wrote: > Hi guys, > > > > I'm trying to solve the problems from the last round and I'm currently stuck > on the first problem. I came up with the code shown below, and it finds the > path without violating the given constraints, but the system says that the > answer is wrong. Does anyone see what's wrong with my code? Thanks in advance! > > > > t = int(input()) > > for i in range(1, t + 1): > > r, c = [int(n) for n in input().split()] > > if r * c < 10 or r < 2 or c < 2: > > print('Case #{}: IMPOSSIBLE'.format(i)) > > else: > > print('Case #{}: POSSIBLE'.format(i)) > > s, b, k = 0, 0, 3 if r == 2 or c == 2 else 2 > > if c >= r: > > for _ in range(0, c): > > for j in range(0, r): > > p = j + 1 > > q = (s + k if b else s) % c + 1 > > print('{} {}'.format(p, q)) > > b ^= 1 > > s, b = s + 1, 0 > > else: > > for _ in range(0, r): > > for j in range(0, c): > > p = (s + k if b else s) % r + 1 > > q = j + 1 > > print('{} {}'.format(p, q)) > > b ^= 1 > > s, b = s + 1, 0 > > > > -- > > 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/bea43a97-c1c8-4b4c-8713-8eb0d2c8088b%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout.
Hello Juarez, It helps indeed. Thanks a lot for your help! Andre -- 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/3ad9d0d7-cd2a-47ec-a67b-c1040c5b084c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
