|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
[numbers] How many lines, about, are in the input file?
...or will you not tell?
Just wondering if it's better to find a few solutions quickly and run to the end of the input file, or vice versa? It's ok also if we don't know, just means more coding to cover all the bases :-) regards, Samuli |
|
#2
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
I hope that we will have to do our best in every situation... from one line to one hundred!
|
|
#3
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
The file will have at minimum 5 lines and at maximum 50 lines.
|
|
#4
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
So, in the case that there are fifty lines, the script should be able to solve each line in 30/50, or 0.6 seconds?
Example: the input file has fifty lines in it, and my script finds 100 out of 120 solutions to line one, but doesn't solve lines two through fifty, and another script finds two solutions to each of the fifty lines. Both scripts used the full 30 seconds. Which is the better script? |
|
#5
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
Neither of course... If you know that the input file has 50 lines, you should optimize for that number 50.
|
|
#6
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
You say neither... but what if, just for an example, those were the only two submissions?
|
|
#7
|
|||
|
|||
|
[numbers] RE: RE: How many lines, about, are in the input file?
Quote:
I find it hard to believe that both scripts are going to use EXACTLY 30 seconds. The winner is going to be the faster script. |
|
#8
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
But what if both scripts check the elapsed time periodically, and stop when they reach thirty seconds?
|
|
#9
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
Well first, there is going to be more than a single run of the scripts, so there will be more data to deal with. Secondly, I still find it hard to believe that both scripts are going to end up with the same run time down to the millisecond...
If for some reason after multiple runs, we have two scripts that have achieved the exact same number of solutions and have the exact same run times then we will deal with it when we get there. |
|
#10
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
Ok, I'm satisfied now.
|
|
#11
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
at least there would be no equal lines?
and lines that have different types of distinct results? like: 1+2+3=6 a+b+c=d (6+2)/4=2 (a+b)/c=d 9+8-7=10 a+b-c=d it would not be fair if all the lines has the same type of results: 1+2+3=6 a+b+c=d 2+3+4=9 a+b+c=d 5+3+7=15 a+b+c=d |
|
#12
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
Sorry, I don't understand.
|
|
#13
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
ok!
suppose that for generating all the lines you use this type of logic: for a,b,c,target; a) a*b*c=target b) a,b,c,(a*b*c+1) note: the results are 0 now suppose I made a script that calculates all posible combinations of a,b,c in max time of 3 seconds. and suppose some kid makes a scripts that calculates the combination a*b*b, and no other combination, he does is on 0.5 secs. well, by the rules, he is a winner! but if the rule a) is a-b-c=target he would not be on the winners list. my point is that the lines on the input file should be checked, so that each line doesn't has too many results, and the results should be obtained by different combinations(since time is our limit), so that none script has performance advantage. example: this could be returned by one algorithm: a+b/c=target but this?: (a+b)/c=target surely one algorithm could return both, but at the cost of time. if there are lots of a+b/c=target , the first algorithm surely will be the winner, but I belive it would not be the best, since if there are lots of (a+b)/c=target it would be a looser. But if there are the same types of results of a+b/c=target and (a+b)/c=target none of the scripts will be on the winners list, if theres a script that checks both types of results! how could this issue be resolved? |
|
#14
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
and suppose some kid makes a scripts that calculates the combination a*b*b, and no other combination, he does is on 0.5 secs.
_____________________________________ should be and suppose some kid makes a scripts that calculates the combination a*b*c, and no other combination, he does is on 0.5 secs. |
|
#15
|
|||
|
|||
|
[numbers] RE: How many lines, about, are in the input file?
Total number returned is still higher priority than time spent. Time spent is only the tie-breaker.
For example if the numbers were 100 1 2 3 4 5 and goal was 105, then the person that gets "100+1+4" and "100+2+3" in .0000001 second (2 total) will lose to someone that gets "100+1+4", "100+2+3", "100+5", "100+1+4+5-2-3", "100+2+3+5-1-4" in 29.9999999 seconds. |
![]() |
| Viewing: Codewalkers Forums > PHP Contests > Older Contests > [numbers] How many lines, about, are in the input file? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|