Google Code Jam 1B — Blindfold Bullseye Help

Правка en1, от aakshu, 2020-04-23 07:31:49

Problem Link: https://codingcompetitions.withgoogle.com/codejam/round/000000000019fef2/00000000002d5b63

Hey Guys, So I'm a total beginner and breaking my head trying to solve the interactive problem in the contest. Thus I apologise if the question is too dumb. Any help would really really really be appreciated!

So I saw a youtube video on how to solve the problem(Link:https://www.youtube.com/watch?v=2VpNqhXFq2M) and tried to implement the same solution. Approach is the same as the analysis provided by code jam I guess.

Find a single HIT, from there use 4 binary searches to get the 4 edge points of the dart board in the vertical and horizontal directions. then the mid points of the opposite x and y coordinates are the center. The submission gives me a TLE, which i can't figure out why.

Here is the link to my solution: https://ideone.com/PUQHma

I tried downloading the interactive_runner.py and testing_tool.py as mentioned in the problem, Running both the files along with my solution just leaves me with what i'm assuming the program waiting for input? Here is the screenshot:

It proceeds to accept infinite numbers when i try to enter using keyboard and only way to exit is forcefully break using the terminal command, upon which it gives me the following error:

So i'm out of ideas honestly? I used endl at every cout so i'm sure output flushes everytime, In an attempt to gain more understanding, I tried printing 300 random values hoping to get a WA, but still got TLE.

Link to code: https://ideone.com/N8cadQ

No idea why it's generating TLE, but i'm assuming it can be because one of the random values is actually the center, so judge sends "CORRECT" and stops communicating, while my cin int the next loop forever waits for an input from judge.

So to get WA i went a step further and incorrectly formatted an output, which as clearly mentioned in the problem should give a WRONG verdict and judge should stop communicating, wait for my program to end and give WA, but it still gives TLE only.

Link to code: https://ideone.com/j5CMJa

I'm really at my wits end, Any pointers on how i should proceed would really help.

Thank you!

Теги gcj 1b, gcj

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский aakshu 2020-04-23 07:31:49 2382 Initial revision (published)