Which is more important in determining author order: time spent or results obtained?
In my field, this would clearly be shared (first) authorship.

As for the exact positions, in my experience one of A and B would also have been spending a lot of time as a de facto project lead that determines the course of the project and does most of the writing. In fact, in my field this would almost always be B, unless A somehow has the capabilities of effectively leading multiple projects and delegating vast proportions of the work in those projects.

I don't place a lot of value on happening to find the right solution for a problem. The way you describe this, it seems almost stochastic: A proposed four solutions and got lucky, B proposed more solutions but didn't get lucky. Obviously the situation and value of contributions changes if B could not have found the solution, but A (possibly because of greater experience) could have.

Two other considerations: first, exact position on a paper can have very different values for different people. A first first authorship can be absolutely vital for scientists who are rounding off their PhD or postdoc, whereas scientists who aren't rounding off could also obtain this in a next project. Second, maybe there are ways to even out the author contributions? One way would be to do another project together and flip author positions for that one. Another way would be that the person who doesn't get author precedence can present the work at conferences for the first year. And maybe there are better ideas that someone in your lab can come up with.