Help in Checkpoints (June cookoff 2020)
This is my code and I am getting a WA for this. I am unable to find where am I going wrong.
(Edit : got it , made really bad silly mistakes, thanks anyways,

clear the map ?, ya I actually forget to do that but still I am getting TLE

why are you running output n times ? you just need to do that once in every test case.

you are taking one input and printing output of collected input so far.

1 Like

yaa bro my bad I had many submission for this I posted the wrong one I have edited the right one

Still their is WA in my code

no you are printing result out of test case loop?

if these blocks confuses you try making function like this

solve() { ... }

main () {
       int t; cin >> t;
       while (t--) solve();

yaa I changed it, but still WA

also i don’t think if your mapping keys are correct,

we need to categorize poitns on two ways .

  1. their intecept on x - axis ( x - y ) and,
  2. (distant of point ( 0 , x ) - coordinate with intercept on x - axis ( 0 , x- y ) ) mod c - > ( x - ( x - y ) ) % c,

here this ( x - ( x - y ) ) could also have been negatice so inorder too take its mod you would have to keep it multiplying with c until it is positive.

consider my submission for help :

yup I made a error in the intercept part, thanks bro I got it now.

1 Like