https://www.codechef.com/viewsolution/34705470
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,
CodeChef: Practical coding for everyone)
clear the map ?
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.
yaa bro my bad I had many submission for this I posted the wrong one I have edited the right one
https://www.codechef.com/viewsolution/34705396
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 .
- their intecept on x - axis ( x - y ) and,
- (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 : CodeChef: Practical coding for everyone
yup I made a error in the intercept part, thanks bro I got it now.