結果
問題 | No.2561 みんな大好きmod 998 |
ユーザー | Yoichiro Nishimura |
提出日時 | 2023-12-02 15:04:01 |
言語 | PHP (8.3.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,526 bytes |
コンパイル時間 | 3,138 ms |
コンパイル使用メモリ | 30,736 KB |
実行使用メモリ | 31,272 KB |
最終ジャッジ日時 | 2024-09-26 18:00:05 |
合計ジャッジ時間 | 13,740 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 46 ms
31,132 KB |
testcase_01 | AC | 80 ms
31,156 KB |
testcase_02 | AC | 46 ms
31,248 KB |
testcase_03 | AC | 681 ms
31,116 KB |
testcase_04 | AC | 677 ms
30,940 KB |
testcase_05 | WA | - |
testcase_06 | AC | 672 ms
30,804 KB |
testcase_07 | AC | 46 ms
31,088 KB |
testcase_08 | AC | 44 ms
31,024 KB |
testcase_09 | AC | 45 ms
31,132 KB |
testcase_10 | AC | 44 ms
30,928 KB |
testcase_11 | AC | 139 ms
30,996 KB |
testcase_12 | AC | 45 ms
31,260 KB |
testcase_13 | AC | 45 ms
30,960 KB |
testcase_14 | AC | 45 ms
31,124 KB |
testcase_15 | AC | 680 ms
30,904 KB |
testcase_16 | AC | 46 ms
30,868 KB |
testcase_17 | AC | 45 ms
30,892 KB |
testcase_18 | AC | 45 ms
30,924 KB |
testcase_19 | AC | 507 ms
31,096 KB |
testcase_20 | AC | 45 ms
30,972 KB |
testcase_21 | AC | 42 ms
31,096 KB |
testcase_22 | AC | 43 ms
31,052 KB |
testcase_23 | AC | 42 ms
31,108 KB |
testcase_24 | AC | 43 ms
31,272 KB |
testcase_25 | AC | 42 ms
31,040 KB |
testcase_26 | AC | 172 ms
30,976 KB |
testcase_27 | AC | 678 ms
31,240 KB |
testcase_28 | AC | 214 ms
30,992 KB |
testcase_29 | AC | 97 ms
30,924 KB |
testcase_30 | AC | 212 ms
31,120 KB |
testcase_31 | AC | 379 ms
31,164 KB |
testcase_32 | AC | 116 ms
30,904 KB |
testcase_33 | AC | 99 ms
31,144 KB |
testcase_34 | AC | 683 ms
31,256 KB |
testcase_35 | AC | 89 ms
30,912 KB |
testcase_36 | AC | 87 ms
30,944 KB |
testcase_37 | AC | 65 ms
31,104 KB |
testcase_38 | AC | 140 ms
30,876 KB |
testcase_39 | AC | 216 ms
31,160 KB |
testcase_40 | AC | 216 ms
30,988 KB |
testcase_41 | AC | 143 ms
30,912 KB |
testcase_42 | AC | 217 ms
31,120 KB |
testcase_43 | AC | 66 ms
30,944 KB |
testcase_44 | AC | 121 ms
31,016 KB |
testcase_45 | AC | 510 ms
30,960 KB |
testcase_46 | AC | 101 ms
31,020 KB |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php [$N, $K] = ints(); $A = ints(); $ans = 0; dfs(0,0,0); echo $ans%998; function dfs($i, $p, $sum){ global $N, $K, $A, $ans; if($i == $K){ // o($sum); $ans+=$sum%998>=$sum%998244352; return; } for($j = $p; $j < $N; $j++){ dfs($i+1, $j+1, $sum+$A[$j]); } } function str(){return trim(fgets(STDIN));} function ints($n = false){ if($n===false){ $str = trim(fgets(STDIN));if($str == '')return []; return array_map('intval',explode(' ',$str)); }else{$ret = [];for($i = 0; $i < $n; $i++)foreach(array_map('intval',explode(' ',trim(fgets(STDIN)))) as $j => $v)$ret[$j][] = $v;return $ret;} } function int(){return intval(trim(fgets(STDIN)));} function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;} function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;} function isqrt($n):int{$res=intval(sqrt($n))+1;while($res*$res>$n)$res--;return $res;} function popcount($x){$c=0;while($x){$x&=$x-1;++$c;}return$c;} function swap(&$a,&$b){$tmp=$a;$a=$b;$b=$tmp;} function o(...$val){ if(count($val)==1)$val=array_shift($val); echo debug_backtrace()[0]['line'].")"; if(is_array($val)){ if(count($val) == 0)echo "empty array\n"; elseif(!is_array(current($val)))echo "array: ",implode(" ", addIndex($val)),"\n"; else{ echo "array:array\n"; if(isCleanArray($val))foreach($val as $row)echo implode(" ", addIndex($row)),"\n"; else foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row)),"\n"; } }else echo $val."\n"; } function addIndex($val){if(!isCleanArray($val)){$val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);}return $val;} function isCleanArray($array){$clean=true;$i = 0;foreach($array as $k=>$v){if($k != $i++)$clean = false;}return $clean;} // 座圧対象の配列 -> [圧縮された配列,復元用のMap,圧縮用のMap] function atsu($array){$a = array_flip($array);$fuku=array_flip($a);sort($fuku);$atsu = array_flip($fuku);foreach($array as $i=>$val)$array[$i]=$atsu[$val];return [$array, $fuku, $atsu];} function atsu1($array){$a=array_flip($array);$fuku=array_flip($a);sort($fuku);array_unshift($fuku,0);unset($fuku[0]);$atsu=array_flip($fuku);foreach($array as $i=>$val)$array[$i]=$atsu[$val];return [$array, $fuku, $atsu];} function median($a){sort($a);$n=count($a);return $n%2?$a[($n-1)/2]:($a[$n/2-1]+$a[$n/2])/2;} function gcdAll($array){$gcd=$array[0];for($i=1,$I=count($array);$i<$I;++$i){$gcd=gcd($gcd,$array[$i]);}return $gcd;} function gcd($m, $n){if(!$n)return $m;return gcd($n, $m % $n);} function lcmAll($array){$lcm=$array[0];for($i=1,$I=count($array);$i<$I;++$i){$lcm=lcm($lcm,$array[$i]);}return $lcm;} function lcm($a, $b) {return $a / gcd($a, $b) * $b;} function loadTree($N = false){ if($N === false)$N = $GLOBALS['N']; return loadGraph($N, $N-1); } function loadGraph($N = false, $M = false, $both = true){ if($N === false)$N = $GLOBALS['N']; if($M === false)$M = $GLOBALS['M']; $G = array_fill(1, $N, []); for($i = 0; $i < $M; $i++){ $values = ints(); if(count($values) == 2){ list($a, $b) = $values; if($both == 0){ $G[$a][] = $b; }elseif($both == 1){ $G[$a][] = $b; $G[$b][] = $a; }else{ $G[$b][] = $a; } }else{ list($a, $b, $d) = $values; if($both == 0){ $G[$a][] = [$b, $d]; }elseif($both == 1){ $G[$a][] = [$b, $d]; $G[$b][] = [$a, $d]; }else{ $G[$b][] = [$a, $d]; } } } return $G; }