Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
#include <bits/stdc++.h>
using namespace std;
#define for0(i, n) for(int i=0;i<n;i++)
#define for1(i, n) for(int i=1;i<=n;i++)
#define forr0(i, n) for(int i=n-1;i>=0;i--)
#define forr1(i, n) for(int i=n;i>0;i--)
#define forc(i, m, n) for(int i=m; i<n;i++)
#define ll long long
#define fs first
#define se second
#define push push_back
#define pop pop_back
const ll mod1 = 1000000007, mod2 = 998244353;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t,n,x;
int a[100000];
cin>>t;
while(t--){
cin>>n>>x;
for0(i, n) cin>>a[i];
int m = a[0], M = a[0];
for0(i, n){
m = min(m, a[i]);
M = max(M, a[i]);
}
if(x <= M && x >= m) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define for0(i, n) for(int i=0;i<n;i++)
#define for1(i, n) for(int i=1;i<=n;i++)
#define forr0(i, n) for(int i=n-1;i>=0;i--)
#define forr1(i, n) for(int i=n;i>0;i--)
#define forc(i, m, n) for(int i=m; i<n;i++)
#define ll long long
#define fs first
#define se second
#define push push_back
#define pop pop_back
const ll mod1 = 1000000007, mod2 = 998244353;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t,n,x;
int a[100000];
cin>>t;
while(t--){
cin>>n>>x;
for0(i, n) cin>>a[i];
int m = a[0], M = a[0];
for0(i, n){
m = min(m, a[i]);
M = max(M, a[i]);
}
if(x <= M && x >= m) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
for _ in range(int(input())):
n,x=map(int,input().split())
s=list(map(int,input().split()))
s.sort()
if s[0]<=x<=s[-1]: print("YES")
else: print("NO")
#include <stdio.h>
int main(void) {
int t, n, x, i, min, max;
scanf("%d", &t);
while(t--){
scanf("%d %d", &n, &x);
int S[n];
for ( i = 0; i < n; i++)
{
scanf("%d", &S[i]);
}
min = S[0];
max = S[0];
for(i=0; i<n; ++i)
{
// scanf("%d", &S[i]);
if(S[i]<min)
min = S[i];
if(S[i]>max)
max = S[i];
}
if(x>=min && x<= max) printf("YES\n");
else printf("NO\n");
//printOutput(x, n, S);
}
return 0;
}
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static String solve(int[]arr,int n,int x){
// for(int i:arr)if(i==x)return "YES";
int max=0,min=arr[0];
for(int i=0;i<n;i++){
min=Math.min(min,arr[i]);
max=Math.max(max,arr[i]);
}
if(max>=x && x>=min)return "YES";
return "NO";
}
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int x=sc.nextInt();
int[]arr=new int[n];
for(int i=0;i<n;i++)
arr[i]=sc.nextInt();
System.out.println(solve(arr,n,x));
}
}
}
for _ in range(int(input())):
n, x = map(int, input().split())
s = list(map(int, input().split()))
if min(s) <= x <= max(s):
print('YES')
else:
print('NO')
# Proof
# If S contains two elements x-a and x+b (a,b >= 0), then let A be as follows:
# [b copies of (x-a), a copies of (x-b)]. The average will be x. (easy to check)
# So you just need to check if you have two such elements in S. It's enough to check min and max.
T = input()
while T>0:
N,X = map(int,raw_input().split())
S = map(int,raw_input().split())
if X in S: print "YES"
elif max(S)<X: print "NO"
elif min(S)>X: print "NO"
else: print "YES"
T-=1
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Numerics;
public class Test
{
public static void Main()
{
int A = GetInt();
while(A-- != 0)
{
int[] arr = GetIntArray();
int[] ar2 = GetIntArray();
int maxi=int.MinValue, mini=int.MaxValue;
for(int i=0;i<arr[0];i++){
maxi = Math.Max(maxi, ar2[i]);
mini = Math.Min(mini, ar2[i]);
}
if(arr[1]>=mini && arr[1]<=maxi) Console.WriteLine("YES");
else Console.WriteLine("NO");
}
// your code goes here
}
public static void Writex(string s) => (Console.WriteLine(s));
public static int GetInt() => int.Parse(Console.ReadLine());
public static long GetLong() => long.Parse(Console.ReadLine());
public static string GetString() => (Console.ReadLine());
public static string[] GetStringArray() => Console.ReadLine().Trim().Split(' ');
public static int[] GetIntArray() => Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
public static long[] GetLongArray() => Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
let array = "";
process.stdin.on('data', function (line) {
array += line;
});
process.stdin.on('end', function () {
array = array.split("\n");
let cases = parseInt(array.shift());
for (let i = 0; i < cases; i++) {
let newArr=array.shift().split(' ').map(x=>parseInt(x));
let s=array.shift().split(' ').map(x=>parseInt(x));
s.sort((a,b)=>{return a-b});
if(s[0]<=newArr[1] && s[newArr[0]-1]>=newArr[1]){
console.log('YES')
}else{
console.log('NO')
}
}
});
package main
import (
"bufio"
"bytes"
"fmt"
"os"
"sort"
)
func main() {
reader := bufio.NewReader(os.Stdin)
tc := readNum(reader)
var buf bytes.Buffer
for tc > 0 {
tc--
n, x := readTwoNums(reader)
A := readNNums(reader, n)
res := solve(x, A)
if res {
buf.WriteString("YES\n")
} else {
buf.WriteString("NO\n")
}
}
fmt.Print(buf.String())
}
func readUint64(bytes []byte, from int, val *uint64) int {
i := from
var tmp uint64
for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
tmp = tmp*10 + uint64(bytes[i]-'0')
i++
}
*val = tmp
return i
}
func readInt(bytes []byte, from int, val *int) int {
i := from
sign := 1
if bytes[i] == '-' {
sign = -1
i++
}
tmp := 0
for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
tmp = tmp*10 + int(bytes[i]-'0')
i++
}
*val = tmp * sign
return i
}
func readString(reader *bufio.Reader) string {
s, _ := reader.ReadString('\n')
for i := 0; i < len(s); i++ {
if s[i] == '\n' {
return s[:i]
}
}
return s
}
func readNum(reader *bufio.Reader) (a int) {
bs, _ := reader.ReadBytes('\n')
readInt(bs, 0, &a)
return
}
func readTwoNums(reader *bufio.Reader) (a int, b int) {
res := readNNums(reader, 2)
a, b = res[0], res[1]
return
}
func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
res := readNNums(reader, 3)
a, b, c = res[0], res[1], res[2]
return
}
func readNNums(reader *bufio.Reader, n int) []int {
res := make([]int, n)
x := 0
bs, _ := reader.ReadBytes('\n')
for i := 0; i < n; i++ {
for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
x++
}
x = readInt(bs, x, &res[i])
}
return res
}
func solve(X int, A []int) bool {
sort.Ints(A)
if X < A[0] || A[len(A)-1] < X {
return false
}
return true
}
In our experience, we suggest you solve this Average Gift CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Average Gift CodeChef Solution.
I hope this Average Gift CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Programming Language in a business context; there are no prerequisites.
Keep Learning!