Submission #172051


Source Code Expand

Copy
<?php
    //$DEBUG = 1;
    //if ($DEBUG) ini_set('display_errors', 'On');
    //if ($DEBUG) ini_set('error_reporting', E_ALL & ~E_NOTICE);
    
    define ('HEN', 1000000007);
    
    $m = array();
    
	fscanf(STDIN, "%d\n", $N);
	$A = explode(" ", trim(fgets(STDIN)));
	
	$flag = FALSE;
	$cnt = 0;
	$score = 1;
	
	for ($i = 0; $i < $N; $i++)
	{
	    if ($A[$i] == '-1')
	    {
	        $flag = TRUE;
	        $cnt++;
	    } else
	    {
	        if ($flag === TRUE)
	        {
	            $flag = FALSE;
	            $score *= calc($A[$i] - $moto + $cnt, $cnt);
	            $cnt = 0;
	        }
	        $moto = $A[$i];
	    }
	}
    
    echo ($score % HEN) . PHP_EOL;
    
    function calc($a, $b)
    {
        $score = 1;

        for ($i = 0; $i < $b; $i++)
        {
            $score *= ($a - $i);
            $score /= ($i + 1);
        }
        
        $score = $score % HEN;
        
        //echo "a:{$a} b:{$b} score:{$score}\n";

        return $score % HEN;
    }

Submission Info

Submission Time
Task C - タコヤ木
User takepan
Language PHP (PHP 5.3.10)
Score 0
Code Size 1040 Byte
Status WA
Exec Time 45 ms
Memory 4324 KB

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3
Score / Max Score 0 / 0 0 / 50 0 / 30 0 / 20
Status
AC × 2
WA × 1
AC × 12
WA × 2
AC × 19
WA × 7
AC × 22
WA × 14
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt
Subtask2 sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt
Subtask3 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask3_01.txt, subtask3_02.txt, subtask3_03.txt, subtask3_04.txt, subtask3_05.txt, subtask3_06.txt, subtask3_07.txt, subtask3_08.txt, subtask3_09.txt, subtask3_10.txt, subtask3_11.txt, subtask3_12.txt
Case Name Status Exec Time Memory
sample_01.txt AC 41 ms 3712 KB
sample_02.txt AC 41 ms 3768 KB
sample_03.txt WA 41 ms 3716 KB
subtask1_01.txt AC 41 ms 3760 KB
subtask1_02.txt AC 42 ms 3768 KB
subtask1_03.txt AC 39 ms 3712 KB
subtask1_04.txt AC 42 ms 3712 KB
subtask1_05.txt AC 40 ms 3764 KB
subtask1_06.txt AC 42 ms 3720 KB
subtask1_07.txt WA 41 ms 3768 KB
subtask1_08.txt AC 42 ms 3816 KB
subtask1_09.txt AC 40 ms 3700 KB
subtask1_10.txt AC 40 ms 3768 KB
subtask1_11.txt AC 40 ms 3716 KB
subtask1_12.txt WA 42 ms 3812 KB
subtask2_01.txt AC 40 ms 3712 KB
subtask2_02.txt AC 41 ms 3660 KB
subtask2_03.txt AC 40 ms 3764 KB
subtask2_04.txt AC 40 ms 3892 KB
subtask2_05.txt AC 44 ms 4064 KB
subtask2_06.txt WA 41 ms 3892 KB
subtask2_07.txt WA 43 ms 4196 KB
subtask2_08.txt AC 42 ms 4192 KB
subtask2_09.txt AC 42 ms 4188 KB
subtask2_10.txt WA 43 ms 4192 KB
subtask2_11.txt WA 44 ms 4184 KB
subtask2_12.txt WA 43 ms 4196 KB
subtask3_01.txt AC 40 ms 3712 KB
subtask3_02.txt AC 39 ms 3720 KB
subtask3_03.txt WA 40 ms 3716 KB
subtask3_04.txt WA 42 ms 4200 KB
subtask3_05.txt WA 41 ms 3812 KB
subtask3_06.txt WA 44 ms 4076 KB
subtask3_07.txt AC 43 ms 4192 KB
subtask3_08.txt AC 43 ms 4320 KB
subtask3_09.txt AC 45 ms 4272 KB
subtask3_10.txt WA 44 ms 4276 KB
subtask3_11.txt WA 43 ms 4276 KB
subtask3_12.txt WA 42 ms 4324 KB