Submission #172572


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 *= Combination($A[$i] - $moto + $cnt, $cnt);
	            $cnt = 0;
	        }
	        $moto = $A[$i];
	    }
	}
    
    echo ($score % HEN) . PHP_EOL;
    
    function Combination($n, $m)
    {
        $arrN = array();
        $arrM = array();
        
        for ($i = 0; $i < $m; $i++)
        {
            $arrN[] = $n - $i;
            if ($i == 0) continue;
            $arrM[] = $i + 1;
        }
        
        foreach ($arrN as $colN => $intN)
        {
            foreach ($arrM as $colM => $intM)
            {
                if ($arrN[$colN] % $intM == 0)
                {
                    $arrN[$colN] /= $intM;
                    unset($arrM[$colM]);
                }
            }
        }
        
        $ret = 1;
        foreach ($arrN as $v)
        {
            $ret *= $v;
        }
        return $ret;
    }
    

Submission Info

Submission Time
Task C - タコヤ木
User takepan
Language PHP (PHP 5.3.10)
Score 0
Code Size 1442 Byte
Status WA
Exec Time 557 ms
Memory 5616 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 × 8
WA × 6
AC × 13
WA × 13
AC × 15
WA × 21
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 42 ms 3728 KB
sample_02.txt AC 41 ms 3724 KB
sample_03.txt WA 41 ms 3716 KB
subtask1_01.txt AC 45 ms 3716 KB
subtask1_02.txt AC 43 ms 3724 KB
subtask1_03.txt AC 40 ms 3588 KB
subtask1_04.txt WA 42 ms 3816 KB
subtask1_05.txt WA 42 ms 3716 KB
subtask1_06.txt WA 42 ms 3724 KB
subtask1_07.txt WA 45 ms 3680 KB
subtask1_08.txt AC 39 ms 3716 KB
subtask1_09.txt WA 41 ms 3816 KB
subtask1_10.txt AC 44 ms 3812 KB
subtask1_11.txt AC 43 ms 3672 KB
subtask1_12.txt WA 43 ms 3816 KB
subtask2_01.txt AC 41 ms 3724 KB
subtask2_02.txt AC 43 ms 3680 KB
subtask2_03.txt AC 43 ms 3720 KB
subtask2_04.txt AC 44 ms 3796 KB
subtask2_05.txt WA 47 ms 4068 KB
subtask2_06.txt WA 43 ms 3820 KB
subtask2_07.txt WA 554 ms 5608 KB
subtask2_08.txt AC 44 ms 4200 KB
subtask2_09.txt WA 49 ms 4324 KB
subtask2_10.txt WA 51 ms 4324 KB
subtask2_11.txt WA 45 ms 4192 KB
subtask2_12.txt WA 48 ms 4200 KB
subtask3_01.txt AC 41 ms 3716 KB
subtask3_02.txt AC 42 ms 3700 KB
subtask3_03.txt WA 41 ms 3724 KB
subtask3_04.txt WA 48 ms 4280 KB
subtask3_05.txt WA 42 ms 3816 KB
subtask3_06.txt WA 45 ms 4068 KB
subtask3_07.txt AC 557 ms 5616 KB
subtask3_08.txt AC 44 ms 4328 KB
subtask3_09.txt WA 49 ms 4328 KB
subtask3_10.txt WA 47 ms 4324 KB
subtask3_11.txt WA 54 ms 4328 KB
subtask3_12.txt WA 45 ms 4208 KB