Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $test = trim(fgets(STDIN));
- for ($i=1; $i<=$test; $i++)
- {
- $tmp = trim(fgets(STDIN));
- $tmp = split(' ', $tmp);
- $n=$tmp[0];
- $l=$tmp[1];
- $tmp = trim(fgets(STDIN));
- $grish=split(' ', $tmp);
- $tmp = trim(fgets(STDIN));
- $dima=split(' ', $tmp);
- for($z=1; $z<=$l;$z++)
- {
- $max=max($grish);
- $max_i=array_search($max, $grish);
- $grish[$max_i]=0;
- }
- for($z=1; $z<=$l;$z++)
- {
- $min=min($dima);
- $min_i=array_search($min, $dima);
- $dima[$min_i]=666;
- }
- for($z=1; $z<=$l;$z++)
- {
- $ind = array_search('666',$dima);
- $dima[$ind]=0;
- }
- $sum_g=array_sum($grish);
- $sum_d=array_sum($dima);
- echo $sum_g;
- echo $sum_d;
- if($sum_g>$sum_d){
- print('YES');
- }
- else{
- print ('NO');
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement