Advertisement
Golden_Rus

Untitled

Mar 28th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2. $test = trim(fgets(STDIN));
  3. for ($i=1; $i<=$test; $i++)
  4. {
  5. $tmp = trim(fgets(STDIN));  
  6. $tmp = split(' ', $tmp);
  7. $n=$tmp[0];
  8. $l=$tmp[1];
  9. $tmp = trim(fgets(STDIN));
  10. $grish=split(' ', $tmp);
  11. $tmp = trim(fgets(STDIN));
  12. $dima=split(' ', $tmp);
  13.  
  14. for($z=1; $z<=$l;$z++)
  15. {
  16. $max=max($grish);
  17. $max_i=array_search($max, $grish);
  18. $grish[$max_i]=0;
  19. }
  20. for($z=1; $z<=$l;$z++)
  21. {
  22. $min=min($dima);
  23. $min_i=array_search($min, $dima);
  24. $dima[$min_i]=666;
  25. }
  26.  
  27. for($z=1; $z<=$l;$z++)
  28. {
  29. $ind = array_search('666',$dima);
  30. $dima[$ind]=0;
  31. }
  32.  
  33. $sum_g=array_sum($grish);
  34. $sum_d=array_sum($dima);
  35.  echo $sum_g;
  36.  echo $sum_d;
  37. if($sum_g>$sum_d){
  38.  print('YES');
  39. }
  40. else{
  41. print ('NO');
  42. }  
  43. }
  44.  
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement