why have my solution failed?

The Partridge Family were neither partridges nor a family. Discuss.
AverageWhale
Posts: 57
Joined: August 13th, 2018, 2:33 pm

why have my solution failed?

Post by AverageWhale » October 4th, 2018, 10:59 am

hello guys. I made my solution and it passed all tests including 80m number test but on the site its shows that my solution failed.
Attachments
New WinRAR ZIP archive.zip
(403 Bytes) Downloaded 147 times

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: why have my solution failed?

Post by Pindrought » October 4th, 2018, 1:16 pm

Just curious, did you upload multiple solutions?

It seems like yours should work? Then again mine says it failed even though I passed every unit test I tried. Wondering if I did something wrong or if the multiple uploads broke it.

To save people from downloading it, this was AverageWhale's code

Code: Select all

#include "Parameters.h"

namespace Solution
{
	Output Solve(const Input& input)
	{
		unsigned int input_size = input.size();

		int current_difference = 0;
		unsigned short max_difference = 0;

		unsigned short min = input[0];

		for (unsigned int i = 0; i < input_size; ++i)
		{
			current_difference = input[i] - min;
			if (current_difference > max_difference)
				max_difference = current_difference;

			if (input[i] < min)
				min = input[i];
		}

		if (max_difference == 0)
			return -1;

		return max_difference;
	}
}
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: why have my solution failed?

Post by chili » October 4th, 2018, 2:12 pm

I'm basically planning on making a feature where you can request manual review, but only for patrons (mainly because i don't wanna spend all my free time manually re-evaluating tons of submissions)

You can be the first guinnea pig pin :D
Chili

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: why have my solution failed?

Post by chili » October 4th, 2018, 2:13 pm

If you upload multiple, it's fine
The last one uploaded is the only one that counts
Chili

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: why have my solution failed?

Post by Pindrought » October 4th, 2018, 3:02 pm

chili wrote:I'm basically planning on making a feature where you can request manual review, but only for patrons (mainly because i don't wanna spend all my free time manually re-evaluating tons of submissions)

You can be the first guinnea pig pin :D
I appreciate it, but my code is a bit convoluted so I wouldn't waste time on it.

I can just download your solution and generate random sets/compare results until mine fails to determine what it was I had wrong.

I am confused as to how AverageWhale's failed though. Seems really straight forward.
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: why have my solution failed?

Post by chili » October 4th, 2018, 5:03 pm

yeah, it *could* be some weird bug with the test framework. Maybe i'll take a look and see the exact seed that causes the failure. This is the first wet run, and obviously if there are any problems we wanna get then ironed out asap
Chili

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: why have my solution failed?

Post by albinopapa » October 4th, 2018, 5:10 pm

After looking through your "Ultimate" solution, yes from what I can tell, our solutions are similar even if our code is different. Still, 44% success, that sucks lol.

I'm sure I messed up somewhere, I got so brain dead by the time I submitted my last one, I just verified that it passed all the tests and submitted, never to think about it again.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Slidy
Posts: 80
Joined: September 9th, 2017, 1:19 pm

Re: why have my solution failed?

Post by Slidy » October 5th, 2018, 12:38 am

I also re-submitted and had no issues, so I doubt it's that.

As for AverageWhale's issue I suspect it might have to do with signed/unsigned mixing going on.

Would be nice if the system gave you the input set that your solution failed on.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: why have my solution failed?

Post by chili » October 5th, 2018, 4:45 am

Don't feel too bad, my ultimate solution also had a silly bug in it that caused it to fail against one of the datasets from the forum thread. The problem was nothing to do with the algorithm itself, just the function i used to distribute workload among threads wasn't ensuring that each thread has a multiple of 8 input elements to work with :roll: So if I were competing on the leaderboard with the rest of you guys, and that dataset had been included in the test suite, I would have gotten 0 algos as well :lol:.

And yes, I also suspect signed/unsigned mixing bullshit to be the root cause.
Chili

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: why have my solution failed?

Post by Pindrought » October 5th, 2018, 9:39 am

Ah ran some test cases and found the culprit of my issues. XD

Had some old logic I forgot to fix for the smaller samples where single threading was being used. RIP
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

Post Reply