|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
[Blackjack] Time limit
Hi!
I am just fiddling with my code and it looks like time could be crucial. Just to get back some confidence in my sctip ;-) 1. Could we get a script running XYZ seconds on the contest machine 2. Should we expect usage of zend optimizer CU maxhb P.S.: 10 Decks --> 7 minutes ... *lol* |
|
#2
|
|||
|
|||
|
[Blackjack] RE: Time limit
Hi!
Quote:
When removing this fabulous profiling class --> 50secs ... Need better software ;-) CU maxhb |
|
#3
|
|||
|
|||
|
[Blackjack] RE: Time limit
It's the same as for previous contest, can't remember where I put it
Zend Optimizer won't be used. |
|
#4
|
|||
|
|||
|
[Blackjack] RE: RE: Time limit
Hi!
Quote:
Just looked through my folders and found the timing script: Code:
<?
error_reporting(E_ALL & ~E_NOTICE);
mt_srand(123);
$start=microtime();
$dummy=array();
for ($a=0; $a<70000; $a++) {
$n=$a%3;
if ($n==0) {
$dummy[mt_rand(0,100)][mt_rand(0,100)]=mt_rand(0,100);
} else
if ($n==1) {
$source=mt_rand(0,100);
$target=mt_rand(0,100);
$tmp=$dummy[$source];
$dummy[$source]=$dummy[$target];
$dummy[$target]=$tmp;
} else
if ($n==2) {
$which=mt_rand(0,100);
if (is_array($dummy[$which]))
asort($dummy[$which]);
}
}
$end=microtime();
list($a,$b)=explode(" ", $start);
list($c,$d)=explode(" ", $end);
echo ($c+$d-$a-$b)." seconds...n";
?>
|
![]() |
| Viewing: Codewalkers Forums > PHP Contests > Older Contests > [Blackjack] Time limit |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|