You are viewing a single comment's thread. Return to all comments →
PHP Solution
<?php $handle = fopen ("php://stdin","r"); fscanf($handle,"%d",$t); for($a0 = 0; $a0 < $t; $a0++){ fscanf($handle,"%d %d",$n,$k); $check=($k != 0) ? fmod($n,$k) == 0 && fmod($n/$k,2) ==0: true; if(!$check){ echo "-1\n"; }else{ $arr=[]; for($i=1;$i<=$n;$i++){ if(empty($arr[$i])){ $arr[$i]=$i+$k; $arr[$i+$k]=$i; } } ksort($arr); foreach($arr as $k => $val){ echo $val . ' '; } echo "\n"; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Absolute Permutation
You are viewing a single comment's thread. Return to all comments →
PHP Solution