fork(1) download
  1. #include <iostream>
  2. #include <limits.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int t, n, j, k;
  7. int max, num, Snum;//min;
  8. cin>>t;
  9. while(t--){
  10. cin>>n>>j>>k;
  11. //min = INT_MAX;
  12. max = INT_MIN;
  13. for(int i=0; i<n; i++){
  14. cin>>num;
  15. if(i==j-1){
  16. Snum = num;
  17. }
  18. /*if(min>num){
  19. min = num;
  20. }*/
  21. if(max<num){
  22. max = num;
  23. }
  24. }
  25. if(k>1){
  26. cout<<"YES"<<endl;
  27. }else if(max>Snum){
  28. cout<<"NO"<<endl;
  29. }else{
  30. cout<<"YES"<<endl;
  31. }
  32. }
  33. return 0;
  34. }
Success #stdin #stdout 0s 5292KB
stdin
3
5 2 3
3 2 4 4 1
5 4 1
5 3 4 5 2
6 1 1
1 2 3 4 5 6
stdout
YES
YES
NO